Google Code Prettify

I just installed google-code-prettify. It only takes a few minutes and the results are really cool:

import java.util.*;

public class Foo {
  private String firstName;

  public Foo(String firstName) {
    this.firstName = firstName;

    // some other junk
  }

  /**
   * Comment here.
   */
  public int getSomething() { ... }
}

Thank you again, Google.


Alex Miller Says:

I used to use Google code prettify as well and it worked pretty well. I switched to a new theme not too long ago and somehow the styles in the theme were incompatible with the styles in prettify. I spent a while (well, ok only a short while) trying to track down the problem and soon became lazy and bored. I ultimately switched to using SyntaxHighlighter which I think looks very nice, maybe even better than Google code prettify.

I don’t know if you’re using prettify directly but you might also enjoy using it through a WordPress plugin: http://www.deanlee.cn/wordpress/google-code-prettify-for-wordpress/.

Eric Burke Says:

I’m using it directly, since I pretty much wrote (copied WordPress default and then made massive edits to) my own custom theme anyway. Not to say my approach is best…the plugin looks easier and less invasive.