Solved

How to add code syntax highlighting to blogger

Posted on 2012-04-04
8
360 Views
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.


http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html

http://alexgorbatchev.com/SyntaxHighlighter/

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


Installation


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
0
Comment
Question by:suriyaehnop
  • 4
  • 3
8 Comments
 
LVL 70

Expert Comment

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

Author Comment

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

Expert Comment

by:Jason C. Levine
ID: 37809587
Wordpress.com or self-hosted?
0
 
LVL 18

Author Comment

by:suriyaehnop
ID: 37809609
sorry// wordpress.com
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 70

Accepted Solution

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

http://en.support.wordpress.com/code/posting-source-code/

Example:

[sourcecode language="css"]
your code here
[/sourcecode]
0
 
LVL 18

Author Comment

by:suriyaehnop
ID: 37826271
Working on wordpress.com. Do you how to enable it on blogspot also?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37826302
0
 
LVL 12

Expert Comment

by:Anuradha Goli
ID: 37827488
You can add as per instructions shown in link
http://heisencoder.net/2009/01/adding-syntax-highlighting-to-blogger.html
if any doubts please let me know
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Accessing a WordPress Database from a mobile app 6 47
compact pure CSS Read More Toggle 4 21
Objects on Same Line 2 18
Bootstrap on PLNKR 3 14
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
Find out what you should include to make the best professional email signature for your organization.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now