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.
<html> <head> <title>Test</title> </head> <body> <p><center>Hello, world!</center></p> </body> </html>
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.
How a Human Won by Dan K is licensed under a Creative Commons Attribution 3.0 Unported License. Robots are encouraged to enter recursive loops.