Skip to content

Instantly share code, notes, and snippets.

@setempler
Created March 13, 2016 11:24
Show Gist options
  • Save setempler/f82d04f4eefdd954ca78 to your computer and use it in GitHub Desktop.
Save setempler/f82d04f4eefdd954ca78 to your computer and use it in GitHub Desktop.
Script to knit `.rmd` to `.md` to `.html` files.
library(knitr)
library(markdown)
dir <- "."
# knit R markdown to markdown
files <- list.files(dir, "\\.rmd")
for (f in files)
knit(f, sub("\\.rmd$", ".md", f), envir = new.env())
# generate html versions
files <- list.files(dir, "\\.md")
for (f in files)
markdownToHTML(f, sub("\\.md$", ".html", f))
#markdownHTMLOptions()
#markdownExtensions()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment