

Google released a neat 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 – see the sample output. (At 44 KB, the JavaScript is a bit too heavy to include in just any page if you don’t need it everywhere, though you can get rid of several KB by trimming the code from whitespace and comments.)
... 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.
[Via Google Code’s featured projects.]
>> More posts
Advertisement
This site unofficially covers Google™ and more with some rights reserved. You can subscribe to the feed, email your tips (alternatively use the non-Gmail email), and join our forum!