How to add code syntax highlighting to blogger

Posted on 2012-04-04
Medium Priority
Last Modified: 2012-04-27
I'm new to blog. I would like to add my powershell code to the blog. I had difficulty to follow below links.



I try to use syntaxhighlighter to add code but i have difficult to follow their instruction:


Basic Steps

To get SyntaxHighlighter to work on you page, you need to do the following:
1.Add base files to your page: shCore.js and shCore.css
2.Add brushes that you want (for example, shBrushJScript.js for JavaScript, see the list of all available brushes)
3.Include shCore.css and shThemeDefault.css
4.Create a code snippet with either <pre /> or <script /> method (see below)
5.Call SyntaxHighlighter.all() JavaScript method

<pre /> method

ADVANTAGES: Works everywhere, graceful fallback if there are script problems, shows up in all RSS readers as regular <pre />

PROBLEMS: Major issue with this method is that all right angle brackets must be HTML escaped, eg all < must be replaced with &lt; This will ensure correct rendering.

SyntaxHighlighter looks for <pre /> tags which have a specially formatted class attribute. The format of the attribute is the same as the CSS style attribute. The only required parameter is brush (see configuration), which should be set as one of the brush aliases

Start from step1, i already no idea to do that.

Please advice
Question by:suriyaehnop
  • 4
  • 3
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37809537
Is this Blogger or WordPress?
LVL 19

Author Comment

ID: 37809581
Wordpress and blogspot. I have 2 blogs
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37809587
Wordpress.com or self-hosted?
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

LVL 19

Author Comment

ID: 37809609
sorry// wordpress.com
LVL 70

Accepted Solution

Jason C. Levine earned 1200 total points
ID: 37814393
For Wordpress.com all you need to do is put the code in the sourcecode shortcode per their instructions:



[sourcecode language="css"]
your code here
LVL 19

Author Comment

ID: 37826271
Working on wordpress.com. Do you how to enable it on blogspot also?
LVL 12

Expert Comment

by:Anuradha Goli
ID: 37827488
You can add as per instructions shown in link
if any doubts please let me know

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Ecommerce has truly become one of the most prosperous ways of monetizing your brand on the Internet. However, when it comes to it, auditing is undoubtedly the lifeblood of this type of business.  This article will help you to conduct your ecommerce …
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question