# https://stackoverflow.com/questions/54634056/how-to-include-an-html-vignette-in-a-binary-r-package
build_vignettes_to_inst <- function() {
devtools::document() # it seems that we have to "document" before we build. (which also updates the vignettes, but we have to do it again below
#, otherwise there will be no folders doc and meta)
devtools::build_vignettes() # Builds vignettes to 'doc' and 'Meta'. Updates '.gitignore'.
unlink(c("inst/doc", "inst/Meta"), recursive = TRUE) # Remove the directories if they exist
dir.create("inst/doc"); dir.create("inst/Meta") # Create empty directories
has_worked <- c( # Copy files to 'inst' subfolders
file.copy(list.files("doc", full.names = TRUE), to = "inst/doc")
, file.copy(list.files("Meta", full.names = TRUE), to = "inst/Meta")
)
unlink(c("doc", "Meta"), recursive = TRUE) # Optional: Remove unwanted directories
return(all(has_worked)) # Returns TRUE if everything worked OK
}
build_vignettes_to_inst() # Call the function
devtools::build(binary = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.