WP-CodeBox: A better R syntax highlighter plugin for WordPress
Posted in R, R and the web, wordpress on October 11th, 2010 by Tal Galili – 4 CommentsToday I was informed of (what I believe is) a better the best WordPress plugin for R syntax highlighting called WP-CodeBox. This plugin doesn’t require any hacks to make it work (as opposed to the WP-Syntax plugin, which I wrote about in the past). WP-CodeBox can be downloaded and installed on a WordPress by searching for it in the “Add New” section in the plugins menu.
WP-CodeBox provides some nice features (some AJAX based) to the display of the code in the post:
- The code box in the post can now be folded (top right of the code box) so the code can be hidden so to not clutter the post (if the code is too long)
- The code box is added with another button (top left of the code box) which allows the reader to see the code in a new window – so to easily enable a copy paste of the code.
- The options of the plugin allows automatic row numbering of the code, control over “tab” length and some other features.
Usage
After installing (and activating) the plugin, in order to add R code to your post you will need to:
1) Only work in HTML mode (not the Visual mode). Or else, the code you will paste will be messed up.
2) Put your code between the <pre> tag, like this:
(Note: make sure that you rewrite the ” – so it will work.)
<pre lang=”rsplus” line=”1″>…Your R code here…</pre>
p.s: Lastly, my thanks goes to guangchuang yu who’s comment on my original post, and he’s post on wp-codebox and R, has introduced me to this better plugin.
p.p.s: in case you blog on WordPress.com, there is also a solution for R syntax highlighting for WordPress.com bloggers.