These are the lines you need (anywhere in head tag):
<link href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" />
Then modify body tag to load the script:...
<body onload='prettyPrint()'>
...
Use:<pre class="prettyprint" style="overflow:auto;">
<!-- Your code goes here -->
</pre>
You don't need to specify the language since the script will guess, but you can if you like:<pre class="prettyprint lang-html">
<!-- HTML code here -->
</pre>
The lang-* class specifies the language file extensions. File extensions supported by default include "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", "xhtml", "xml", "xsl".I've gone back and added the syntax highlighting to all my code examples in previous posts.
No comments:
Post a Comment