The most simple solution may be using
googe-code-pretifier. It will load a javascript library when your blog is rendered and it's able to automatically detect the programming language and highlight your code properly.
- add following two lines in your blog template:
<link href='http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css' rel='stylesheet' type='text/css'/>
<script src='http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js' type='text/javascript'></script>
- Add the javascript library to the 'body' tag in your blog template:
<body onload='prettyPrint()'>
- wrap the code with pre tag:
<pre class="prettyprint"> ... # Your code goes here </pre>
No comments:
Post a Comment