Question. Everything.

Jekyll and Knitr

April 05, 2013

With Knitr, anything is possible (and ridiculously simple). Creating reproducible R code in your jekyll blog is as simple as

library(knitr)
render_jekyll(highlight="pygments")
knit('file.Rmd')

In your .Rmd file, instead of displaying code (using the liquid templates + pygments)

{% highlight r %}
library(knitr)
{% endhighlight %}

we now have

```{r}
library(knitr)
```

That’s it, basically. You will probably want to set up some options (such as defining a path for images). I have created a .R file to automate everything for this blog, which you can find here.

Helpful resources: