Prettify Syntax Highlighting Plugin
Posted: Fri Nov 13, 2009 7:56 am
If two wasn't enough, I've put together a third option to incorporate syntax highlighting into S9Y by way of Prettify (http://code.google.com/p/google-code-prettify/). Prettify is ultra-basic, but very capable, and at just over 20kb for the core files sent client-side, it is exceptionally lightweight.
In the plugin, I'm providing the option to inject the appropriate class name into all PRE and/or CODE tags found on the page. This means that the author doesn't have to do anything special outside of wrapping their code in PRE or CODE tags, then let Prettify apply best-guess highlighting to the content.
For those who like to maintain control, simply flip the switch off and include the class name (prettyprint) for best-guess highlighting, or specify the code language as part of the class name (prettyprint lang-html) if desired. All of these options, as well as the recognized languages that extend the basic class, are spelled out in the plugin administration page.
You can find the plugin on Sourceforge here: http://php-blog.cvs.sourceforge.net/vie ... l_plugins/, and my notes at http://www.pigslipstick.com/index.php?/ ... -Form.html. As always, feedback/suggestions welcome.
In the plugin, I'm providing the option to inject the appropriate class name into all PRE and/or CODE tags found on the page. This means that the author doesn't have to do anything special outside of wrapping their code in PRE or CODE tags, then let Prettify apply best-guess highlighting to the content.
For those who like to maintain control, simply flip the switch off and include the class name (prettyprint) for best-guess highlighting, or specify the code language as part of the class name (prettyprint lang-html) if desired. All of these options, as well as the recognized languages that extend the basic class, are spelled out in the plugin administration page.
You can find the plugin on Sourceforge here: http://php-blog.cvs.sourceforge.net/vie ... l_plugins/, and my notes at http://www.pigslipstick.com/index.php?/ ... -Form.html. As always, feedback/suggestions welcome.