Skip to content

Instantly share code, notes, and snippets.

@rpietro
Created August 15, 2013 18:13
Show Gist options
  • Save rpietro/6243220 to your computer and use it in GitHub Desktop.
Save rpietro/6243220 to your computer and use it in GitHub Desktop.
knitpost function from Jason Fisher's blog at http://jfisher-usgs.github.io/r/2012/07/03/knitr-jekyll/ - i just brought the function to lower case so that i can remember how to call it
KnitPost <- function(input, base.url = "/") {
require(knitr)
opts_knit$set(base.url = base.url)
fig.path <- paste0("figs/", sub(".Rmd$", "", basename(input)), "/")
opts_chunk$set(fig.path = fig.path)
opts_chunk$set(fig.cap = "center")
render_jekyll()
knit(input, envir = parent.frame())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment