devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Custom knit function for vignettes

Open hadley opened this issue 4 years ago • 1 comments

It's possible to customise what happens when you click the "Knit" button with a knit field in the yaml metadata: https://bookdown.org/yihui/rmarkdown-cookbook/custom-knit.html. For README.Rmd and vignettes, we should set this to a function that uses with_temp_install() so you don't need to manually install the package in order to preview vignettes.

(In order for RStudio preview to work, the function needs to output Output created: {path}, e.g. https://github.com/ramnathv/slidify/blob/master/R/slidify.R#L89-L101)

hadley avatar Mar 20 '20 14:03 hadley

The main challenge is that the knit function is run in a child session, so we'll need to think about how to convey what the current package is and where to look for the temporary library. Maybe load_all() could set an env var? (That would at least be consistent with needing to do a load_all() before you can preview dev docs)

hadley avatar Mar 20 '20 14:03 hadley