Syntax Highlighter Added


A few years ago I played around with a javascript library that would perform syntax highlighting on identified code snippets. It looks like the project has progressed and is available now on Google Code, so I added it to the site.

		<p><center>Hello, world!</center></p>

In blog posts I look for any identifiable code snippets, collect the languages being represented, and add the Syntax Highlighter libraries needed to work on them. Above the fold is a code snippet for HTML, and below is also a JavaScript example. In the snippet on a blog page only the HTML library will be called (unless other snippets on the page have code examples), and the full blog posts will have JavaScript as well.

<script language="javascript" src="/js/shBrushJScript.js"></script>

RSS posts will have post-level Syntax Highlighter library references, as well.

Keeping separate lists of snippet/full-post code language references was necessary to make this work in different ways where blog post content would show up, and to prevent duplicate library references. I also had to go inside each "pre" tag and alter < characters due to a limitation with the Syntax Highlighter code.

Prev << Fixed RSS blog post linkage, moved .post files to new pathSyntax Highlighter Upgraded >> Next



RSS iconSite-wide RSS

RSS iconPersonal blog

RSS iconWebsite posts

RSS iconTransportation posts


teeheehee on Twitter@teeheehee@teeheehee at GMail

Follow me on