April 0930

SyntaxHighlighter 2.0

I have just finished updating the site to use the new SyntaxHighlighter v2.0 which, according to the website is:

the new page in history of the project representing a near complete rewrite, clean up, optimization, standard compliance and new features.

So I thought I’d give it a try, there is a process for upgrading from 1.5 (which is what I was previously using) that’s backwards compatible, so all existing code can stay as it is, but I didn’t have much joy with it and decided to simply replace 1.5 with 2.0.

It’s not too hard, once you replace all the JavaScript files (and add any new language script files you want to use) and add the new CSS files (there are new themes if you want the code to look EMacs or Django-esque for instance). About the only thing that’s changed is how you mark up a bit of code, where it used to be

<pre class="c#" style="code">
...
</pre>
this has been replaced with
<pre class="brush: csharp">
...
</pre>
though more brushes and parameters can be passed like so:
<pre class="brush: js; ruler: true; first-line: 10; highlight: [2, 4, 6]">
...
</pre>

I’ve updated all previous posts to use the new approach – if I’ve missed anything please let me know.

Permalink | Comments (0)
Comments are closed