Yes one can use a pre-rendered HTML vignette (I'm therefore only answering your last question; I furthermore think it'll be easier to use "usual" package infrastructure i.e. vignettes). I've described a few approaches in a recent blog post on the R-hub blog. It depends on the reasons why you want to pre-render the documents.
-
You could pre-compute vignettes following the approach described by Jeroen Ooms in an rOpenSci tech note. The gist is to call actual Rmd vignette source something like
.Rmd.orig
and to knit them to .Rmd. The .Rmd fake vignette sources have already executed R code. Therefore it can be used in the R CMD build/check process without creating errors, it can be knit rapidly. -
You could use
purl
&eval
, as global knitr options. See for instance this GitHub thread. A chunk could be line the one fromgooglesheet
```{r, echo = FALSE}
NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true")
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
purl = NOT_CRAN,
eval = NOT_CRAN
)
```