Prettify is embedded in JavaDoc generated to pretty print code tags
such as
{@source} or
{@example} .
Google Code Prettify
Some functions for browser-side pretty printing of code
contained in html.
The lexer 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.
If there's a language not mentioned here, then I don't know it, and don't
know whether it works. If it has a C-like, Bash-like, or XML-like syntax
then it should work passably.
Usage:
-
Include this source file in an html page via <script
type="text/javascript"
src="/path/to/prettify.js"></script>
-
Add
onload="prettyPrint();" to the document body tag.
-
Define style rules. See the example page for examples.
-
Mark the
<pre> and
<code> tags
in your source with
class=prettyprint .
|