Wednesday, 29 April 2009

Using SyntaxHighlighter to display code snippets

Today I found a very handy javascript to display code snippets in web pages, and it can be adapted to work in Blogs as well.

The SyntaxHighlighter is very clever, and can display a lot of different code types, for example C#.

//Here is some C# Code
public void Method()
string test = "display some code in my blog";
test = test.tostring() + "and format it nicely";

There is a nice blog post by Arun K Viswanathan on how to easily adapt the code to work in Blogger. Check it out.