WordPress Plugin for Google Syntax Highlighter

I am a big fan of the source code highlighter used by the Waffle project. Michael Ward recommended it for me to use when I set my blog up a few weeks ago.

Screenshot

The highlighter itself is simple to use on its own - it’s just a javascript include but I had been using another code highlighter which had a WordPress plugin that made it’s use a snap.

I figured it wouldn’t be too hard to create a plugin for the syntax highlighter (which had larger language support including ruby which I needed) and so I did. The plugin is being hosted by WordPress and I encourage you all to take a look and use in your own blogs.

Google Syntax Highlighter for WordPress

11 Responses to “WordPress Plugin for Google Syntax Highlighter”

  1. Josh G Says:

    Thanks Peter - this is gold!

  2. Menekali Says:

    This doesn’t seem to work with 2.3. I’ve installed, activated, and input even the test syntax you have posted, and, it just doesn’t do anything… at all. :( Looked awesome too :(

  3. flu Says:

    hi,

    nice plugin and it works with 2.3,

    but: your plugin writes class=”javascript” in the script tags. this is wrong and produces an xhtml validation error.

    see: http://www.validome.org/validate/?uri=http://www.peterryan.net

    it would be better if you use the attribute type instead of class for script tags.

  4. The Definitive Guide on Wordpress Syntax Highligher Plugins - Cagintranet Web Design Says:

    […] | Author: Peter Ryan Coloring: #4 of 8 Ease of Install/Use: #7 of 8 Line Numbers: Optional PRE or CODE: PRE Other […]

  5. Kévin Dunglas Says:

    Very nice plugin !

    I’ve made some small changes to your HTML markup to get it W3C valid. You can get the modified version here : http://lapin-blanc.net/downloads/google_syntax_highlighter.phps

    With this patch, only the plugin markup will be valid, the core JS code always require to use which is invalid.

    Please include my changes in trunk :P

  6. Darko Bunic Says:

    Hi Peter,
    I use it on my site and it works very nice. I also made few changes to load only brushes that are needed and move load of JavaScript files to the top of HTML page.

    Thank you for your plugin!

  7. Rashed Says:

    Thanks a lot.

  8. Strudel Says:

    Thanks a lot for this plugin.

    One request though. Brush for bash shell script would be really cool feature.

  9. Strudel Says:

    I’ve added bash brush to the plugin. You can get the extended version of the plugin from here

    http://tech.xlab.si/wp-content/uploads/google-syntax-highlighter-with_bash-151.zip

    Thanks a lot to bboy.mr.freeze.

  10. Azrael-Sub7 Says:

    The plugin crack’s the html validation !
    In the function hooked up to the footer you should be use this

  11. A concerned citizen Says:

    FYI…
    Your example on the installation page of your plugin page has a typo.
    http://wordpress.org/extend/plugins/google-syntax-highlighter/installation/
    It is missing the equal sign between class and “ruby”

Leave a Reply