Jan 24, 2010

Code syntax highlighting for a free hosted blogger blog

If an article has source code snippets, the code is the most important part of the web page. It should be clear and easy to read. For this, it is formatted and highlighted to make it attractive. There are different ways to highlight syntax as per their types (like C, .NET, HTML, PHP etc) for a free hosted blogger blog:

1. Use Online Syntax highlighter services:

Before posting the code, get the highlighted html code from the following online services and paste it in blogger post in edit HTML mode where you want.

http://www.tohtml.com:

http://www.neathighlighter.com/

http://puzzleware.net/CodeHtmler/default.aspx

http://www.chami.com/colorizer

http://quickhighlighter.com/

2. For Windows Live Writer:

If you are using windows live writer, you can use following plugins and publish post.

http://www.codeplex.com/wlwSyntaxHighlighter

http://precode.codeplex.com/

http://sourcecodeplugin.codeplex.com/

3. SyntaxHighlighter:

It is the most popular javascript based highlighter. It has support for 3rd party applications like Blogger, Wordpress, Joomla & many others.

See following to use it in blog:

http://urenjoy.blogspot.com/2008/10/publish-source-code-in-blogger.html

http://geektalkin.blogspot.com/2009/11/embed-code-syntax-highlighting-in-blog.html

4. Google Code Prettify:

The main drawback of syntax highlighter is loading time. It is not quick. So, google code prettify is an alternate option:

http://google-code-prettify.googlecode.com/svn/trunk/README.html

http://stackoverflow.com/questions/1852537/how-to-use-prettify-with-blogger-blogspot

Hope it helps.