[]Jimmy's World.org
Not Left, nor right. Just correct.
[]
Jimmy's World Games
Not a Member? - Login or Create an Account
[] Thursday the 20th of November 2008 @ 01:08pm
News Journal Creative Writing Projects Your JW About

PHP Simple Source Highlighter

The simple source highlighter is a simple php include that will turn a string containing C/C++, PHP or Bash script source into colourized, syntax highlighted versions of the same.

This code isn't particularly pretty or complete, but it works and it's simple to integrate if you quickly want to generate html examples of your source.

For some examples of source highlighting check out the examples page. If you like what you see, you can download it from the downloads page.

To be completely upfront, this code isn't particularly bright. Escaped characters will screw up the highlighting (where they effect things like quotes) and complex structures are likely to be displayed wrong. If you want a robust and efficient syntax highlighter, move along. :)

©2008 Aaron Cameron
Benchmarks