It is a truly better and easier way for syntax highlighting of code snippets in a web page with good cross-browser support. It contains a Theme based Customizable CSS file which you can chose from its gallery of theme and a Javascript module file that allows syntax highlighting of source code snippets in an html page. It is also light weighted and have basic support to all C (and friends), Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles languages (because of commenting conventions, doesn't work on Smalltalk, or CAML-like languages), and we don't need to specify the language. Apart this for Clojure, CSS, Go, Haskell, Lua, OCAML, SML, F#, Nemerle, Protocol Buffers, Scala, SQL, TeX, LaTeX, VHDL, Visual Basic, WikiText, XQuery, and YAML. it have an extensible language handlers for other languages in such case you can specify the language.
Setup:
Setup:
- Download CSS and JS file from distribution list http://goo.gl/LRJCU
- Include the script and stylesheets files in your HTML file
<link href="prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="prettify.js"></script>
- Add
onload="prettyPrint()"
to your document's body tag. - Add your code in (Note: No need to set language if you have basic languages like C)
class="prettyprint" / class="language-java"
Post a Comment