Learn R Programming

servr (version 0.32)

vign: Serve R Markdown/HTML package vignettes

Description

Serve package vignettes under the vignettes/ directory. Because the HTML output files should not be included in the source package, this function renders R Markdown/HTML vignettes, displays them in the web browser, and deletes the HTML output files. You will see the HTML output when you click the links on the .Rmd or .Rhtml files (unlike the static HTTP server, the compiled output instead of the source document is displayed).

Usage

vign(dir = ".", ...)

Arguments

dir

The root directory to serve.

...

Server configurations passed to server_config().

Details

When developing R packages, you may want to preview your vignettes once in a while. You can certainly click the button in RStudio to do it, but that requires you to install the package and rebuild the vignettes. With this function, your vignette will be rebuilt automatically when you update the source document. Moreover, because the compilation takes place in the current R session, you can take advantage of devtools::load_all() (which has a keyboard shortcut in the RStudio IDE) to reload your package and see the updated vignette in the web browser.