« Back to blog

Code Formatter for Blogger

This was something that my friend was asking me the other day, after he got a pang of envy looking at my code formatting in my wordpress blog (this blog). Ofcourse, there is no inbuilt method for formatting code in blogger. There are roundabout manners by which you can do it, but its too much trouble to ask for. So, instead of explaining all the weird methods in the world, i decided to Google for an online solution and hit upon this: http://alexgorbatchev.com/SyntaxHighlighter/ This uses different syntaxfiles (JS files) to support the syntax of different languages. Here is a list of all the languages that it supports: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ Also, the whole thing won't work for Blogger by default. You will have to activate the Blogger Mode by setting the configuration. The clear instructions for which are given here: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ Now, there are some sites which do some amazing formatting for a few given languages. Here is one for c# (and other related languages): http://www.manoli.net/csharpformat/ . But the issue comes about when you have to take care of all or more popular languages like Ruby or Scala. So, with that in mind i feel that Syntaxhighlighter is not half as bad a solution. Try it. I found it ok. However, if you do have any better suggestions to make, you are most welcome.