
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.)
Which languages does this tool prettify? According to its author Mike Samuel this...
<<... 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.]
[By Philipp Lenssen | Original post | Comments]
[Advertisement] AdWatcher. Detect Click Fraud. Prevent Click Fraud. Get Your Money Back. [Advertise here]
-
Related Articles:
- Don’t miss your opportunity to be part of Google’s first Code Jam Latin America!
... - Don’t miss your opportunity to be part of Google’s first Code Jam Latin America!
... - All The Code – New Search Engine for Programmers
... - JavaScript Talk (Video)
... - Google’s Webmaster Tools Verification Code
... - Google Code Search Shows Function Outline
...
Comments (No comments)
Post a comment