Last active
May 22, 2020 17:49
-
-
Save sfirke/a75ed7906fa2b773096eec41e6979d35 to your computer and use it in GitHub Desktop.
Function to build R package vignettes, retaining both .md and .Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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