To use an R Markdown file as a vignette, you need to specify an output format appropriate for inclusion in a package (for example, the lightweight html_vignette() output function included in rmarkdown) and to specify the vignette field, which specifies the title, engine, and encoding type of the vignette. See also usethis::use_vignette() for setting up a package vignette.

yml_vignette(.yml, title, engine = "knitr::rmarkdown", encoding = "UTF-8")



a yml object created by yml(), as_yml(), or returned by a yml_*() function


The title of the vignette


The rendering engine for the vignette ("knitr::rmarkdown" by default)


The character encoding for the document ("UTF-8" by default).


a yml object


yml() %>%
  yml_output(html_vignette()) %>%
  yml_vignette("An introduction to R Markdown")
#> ---
#> date: '`r format(Sys.Date())`'
#> output: html_vignette
#> vignette: "%\\VignetteIndexEntry{An introduction to R Markdown} \n    %\\VignetteEngine{knitr::rmarkdown}
#>   \n    %\\VignetteEncoding{UTF-8})"
#> ---