Google Code Prettifier

Google released a client-side code prettifier. What you do is include their JavaScript and CSS files in your HTML page, trigger execution with an onload="prettyPrint()” event, and then find everything in your <pre class="prettyprint">...</pre> elements be nicely colored. According to its author Mike Samuel: “It should work on a number of languages including C and friends, Java, […]

Google released a client-side code prettifier. What you do is include their JavaScript and CSS files in your HTML page, trigger execution with an onload="prettyPrint()” event, and then find everything in your <pre class="prettyprint">...</pre> elements be nicely colored.

According to its author Mike Samuel: “It should work on a number of languages including C and friends, Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk and a decent subset of Perl, but, because of commenting conventions, doesn’t work on Smalltalk, Lisp-like, or CAML-like languages.”

FAQ | Example | Download

Google Code’s featured projects | Google blogoscoped

Google, Google Code Prettifier, Code, CSS, HTML, Java, JavaScript