Saturday, September 27, 2008

Syntax Highlight/Format C#, Java, PHP Code in Blogger

The method I used to put syntax highlighted code in my blog is to use the "Code Format" tool provided by Manoli.net. It works fine but I am just lazy to convert my code every time I post a new entry.

I then try to find another solution. One option is to use SyntaxHighlighter, a Java Script library that does all the syntax highlight jobs for you.

After installation, one problem I faced is that all the "new line" I wrote in "Edit Html" of Compose Page in Blogger are converted to "
". That's not very nice : (

Like everytime, I performed a search and found a good solution here, Using SyntaxHighlighter on BLOGGER. The purpose of additional script is to convert all the "
" found in the code to "new line" chracter. It works fine and here is my sample of highlighted Java code.

(Of course, I will not use silly program like Hello World for this :D )

And here is the result:



Simple, isn't it ?

No comments: