Friday, September 28, 2007

Syntax Highlighting for Code Embedded in Blogger

There are multiple ways for highlighting the syntax of code embedded in Blogger. One way is to generate HTML files directly from VIM using :TOHtml and extract the CSS part in it and use it in Blogger. You can do the same with Textmate or Emacs. Another alternative is to use Prettifier. Prettifier is very easy to use. All you need to do is add a CSS and JavaScript file in your server and link them in your blog template. Please look at the readme file for more details. In my case, Blogger does not allow me to upload JavaScript files and CSS files, so I'm hosting them on a different server. I have updated my earlier posts to use Prettify.

http://codeshepherd.blogspot.com/2007/07/eliza-loves-you-rogerian.html#links
http://codeshepherd.blogspot.com/2007/06/hello-world-orkut-chickenfoot.html#links

The Perl code has turned out bit messy, but the GreaseMonkey JavaScript code looks clean.

1 comment:

xeozus said...

Bro, i think we can use prettifier code from it's original location of that files is placed. Yes, it's from google-code itself. Take a look this URL path: http://google-code-prettify.googlecode.com/svn/trunk/src/

We can use it already. BTW, thank's for the post.