WordPress syntax highlighting for R is a pain

comments 3

Here’s some steps that work for me on WordPress (v3.5)

  1. install the WP SyntaxHighlighter plugin via the Dashboard
  2. install the Lang Pack for WP SyntaxHighlighter. I did this by simply moving the contents of

    into the main plugin directory (from the command line actually) and then activating the Lang Pack that appeared in the plugins part of the dashboard.  That gets us R code highlighting.

  3. Inelegantly remove the weird little green acknowledgements box that seems to clash with everybody’s theme colours by adding the lines
    SyntaxHighlighter.defaults['toolbar'] = false;

    directly before the two calls to


    in the file



  1. Actually the aggressive pink of the default on-white themes got too much and after much messing around trying to get other themes in, I just gave up and used the wp-code-prettify plugin instead. That uses prettify.js, which seems to have calmer colour defaults.

  2. lawlist says

    Thank you so very very very much for this useful write-up — greatly appreciated !!!!! 🙂

  3. This is an absolute life saver, I’ve been havnig a nightmare trying to put together a simple tutorial on WordPress because of the semi-auto-conversion of some HTML elements.Your function worked a treat.Thanks,David

Leave a Reply to Csorba Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.