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!" );
}
}

2 comments: