AaronCameron.net
Not Left, nor right. Just correct.
Jimmy's World Games
Not a Member? - Login or Create an Account
Friday the 3rd of September 2010 @ 10:22am
[]
Front Page Journal Projects Your Profile 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. :)

©2010 Aaron Cameron
Benchmarks