Google Code Prettify

Up till now, I've been using Java2HTML to generate syntax highlighted Java code snippets for my blog. It's useful, but a little cumbersome to have to use a separate application and trim the HTML it generates for each snippet. The HTML it generates is also unavoidably gnarly, which makes tweaking the code after it has been published tedious.

google-code-prettify solves this problem in a neat way - syntax highlighting is performed on the code using JavaScript in the browser. It seems to work pretty well:

 * Hi!
final class HelloWorld {
  // The usual boring example
  public static void main( String[] args ) {
    System.out.println( "Hello Prettified World!" );

AddThis Social Bookmark Button


  1. Have to agree, pretty cool tool, could be useful in the project I am doing this year for the OU. Bookmarked just in case.

    Nice to see a fellow Scot is enjoying himself in the sun and getting paid for it as well.

  2. You can also check out the post by Rajiv Shivane where apart from code highlighting, it also makes the code live. You can click on the parenthesis to collapse and expand them.