R syntax highlighting for bloggers on WordPress.com
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Good news for R bloggers who are using WordPress.com to host their blog.
This week, the good people running WordPress.com (special thanks goes to Yoav Farhi), have added the ability for all the users of the WordPress.com platform to be able to highlight their R code inside posts.
Basically you’ll need to wrap the code in your post like this:
[sourcecode language="r"] test.function = function(r) { return(pi * r^2) } test.function(1) [/sourcecode]
(Which will then look like this:
)
Further details (and other supported languages) can be read about on this WordPress.com support page.
This new feature was possible thanks to the work of Yihui Xie (who create the famous cool animation package for R), who created a R syntax brush for the syntaxhighlighter WordPress plugin (the plugin used by WordPress.com for sytnax highlighting)
p.s: If you are a WordPress.org users (e.g: have a self hosted WordPress blog) and want to enable R syntax highlighting for your blog, I would recommend the use of the WP-Syntax plugin (enhanced with GeSHi version 1.0.8.6) which can be downloaded here.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.