WordPress syntax highlighting for R is a pain

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
    wp-content/plugins/wp-syntaxhighlighter/sample/

    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

    SyntaxHighlighter.all();

    in the file

    wp-syntaxhighlighter.php

3 thoughts on “WordPress syntax highlighting for R is a pain

  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. 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.