AaronCameron.net
Because you all make me very, very tired.
Not a Member? - Login or Create an Account
Thursday the 24th of May 2012 @ 04:50am
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. :)

©2012 Aaron Cameron