Skip to content

Instantly share code, notes, and snippets.

@sfirke

sfirke/render_keep_md.R

Last active May 22, 2020
Embed
What would you like to do?
Function to build R package vignettes, retaining both .md and .Rmd
# From https://stackoverflow.com/questions/45575971/compile-a-vignette-using-devtoolsbuild-vignette-so-that-md-is-kept-in-the-v
# Usage: render_keep_md("tabyls")
render_keep_md <- function(vignette_name){
# added the "encoding" argument to get the oe character passed through correctly to the resulting .Md
rmarkdown::render(paste0("./vignettes/",vignette_name, ".Rmd"), clean=FALSE, encoding = 'UTF-8')
files_to_remove = paste0("./vignettes/",vignette_name, c(".html",".knit.md",".utf8.md"))
lapply(files_to_remove, file.remove)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment