Unobstrusive code highlighting with javascript.

I am adding Dan Webb's CodeHighLighter javascript to provide HTML, CSS, JavaScript, and Ruby code highlighting to my blog.

All you need is to include his different javascript


<script type="text/javascript" src="code_highlighter.js"></script>
<script type="text/javascript" src="javascript.js"></script>
<script type="text/javascript" src="css.js"></script>
<script type="text/javascript" src="html.js"></script>
<script type="text/javascript" src="ruby.js"></script>


A provides the .css styling for the code. I moved all the different css he provides in his example to codehighlighter.css.

Then you just need to wrap the code in these tags:

<pre>
<class="javascript>

0 comments :: Unobstrusive code highlighting with javascript.