Writes the reference pages and index as Quarto files

R/write-reference.R

write_reference

Description

Writes the reference pages and index as Quarto files

Usage

write_reference(
  pkg = ".",
  target_folder = NULL,
  examples = TRUE,
  not_run_examples = NULL,
  template = NULL,
  index_file = NULL,
  index_template = NULL,
  quarto_file_path = NULL
)

Arguments

Arguments Description
pkg Path to the root of the R package. Defaults to ".".
target_folder Path to the folder where the Quarto files will be written. Defaults to NULL, which resolves to "reference/" (or the dir value under pkgsite > reference in _quarto.yml if set).
examples Flag that sets the examples code chunk to be evaluated when the Quarto document is rendered
not_run_examples Flag that sets the “do not run” examples code chunk to be evaluated when the Quarto document is rendered
template The path to a Quarto file that can be used as the template for all of the resulting reference files. If left NULL, pkgsite will use its default template.
index_file The name assigned to the resulting index Quarto file
index_template The path to a Quarto file that can be used as the template for the index Quarto file
quarto_file_path Path to the folder containing _quarto.yml. Use when the Quarto project root differs from the package root (e.g. the package lives in a sub-folder of a larger Quarto project). Must be a directory path. Defaults to NULL, in which case pkg is used.

Value

A set of Quarto files written to the specified path based on the number of Rd files in the package, plus an additional one that is the index.

Examples

library(pkgsite)
example_pkg <- system.file("example", package = "pkgsite")
write_reference(pkg = example_pkg, target_folder = tempdir())
#> 
#> ── pkgsite
#> Creating index file:
#>   `/var/folders/y_/f_0cx_291nl0s8h26t4jg6ch0000gp/T/RtmprOYvxQ/index.qmd`
#> 
#> Converting .Rd to .qmd:
#>   `/Users/edgar/Library/R/arm64/4.5/library/pkgsite/example/man/index_to_qmd.Rd`
#>   →
#>   `/var/folders/y_/f_0cx_291nl0s8h26t4jg6ch0000gp/T//RtmprOYvxQ/index_to_qmd.qmd`
#> 
#>   `/Users/edgar/Library/R/arm64/4.5/library/pkgsite/example/man/rd_to_list.Rd`
#>   →
#>   `/var/folders/y_/f_0cx_291nl0s8h26t4jg6ch0000gp/T//RtmprOYvxQ/rd_to_list.qmd`
#> 
#>   `/Users/edgar/Library/R/arm64/4.5/library/pkgsite/example/man/rd_to_qmd.Rd` →
#>   `/var/folders/y_/f_0cx_291nl0s8h26t4jg6ch0000gp/T//RtmprOYvxQ/rd_to_qmd.qmd`

See Also

Other Quarto file creation: write_reference_index(), write_reference_pages()