Solved

How to add code syntax highlighting to blogger

Posted on 2012-04-04
8
359 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
Comment Utility
Is this Blogger or WordPress?
0
 
LVL 18

Author Comment

by:suriyaehnop
Comment Utility
Wordpress and blogspot. I have 2 blogs
0
 
LVL 70

Expert Comment

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

Author Comment

by:suriyaehnop
Comment Utility
sorry// wordpress.com
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 300 total points
Comment Utility
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
Comment Utility
Working on wordpress.com. Do you how to enable it on blogspot also?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
Comment Utility
0
 
LVL 12

Expert Comment

by:Anuradha Goli
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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 …
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 viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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

10 Experts available now in Live!

Get 1:1 Help Now