build_articles: Build articles

View source: R/build-articles.R

build_articlesR Documentation

Build articles

Description

Each Rmarkdown vignette in vignettes/ and its subdirectories is rendered. Vignettes are rendered using a special document format that reconciles html_document() with your pkgdown template.

Usage

build_articles(
  pkg = ".",
  path = "docs/articles",
  depth = 1L,
  encoding = "UTF-8",
  quiet = TRUE,
  vignettes_directory = "vignettes"
)

Arguments

pkg

Path to source package. If R working directory is not set to the source directory, then pkg must be a fully qualified path to the source directory (not a relative path).

path

Output path. Relative paths are taken relative to the pkg directory.

depth

Depth of path relative to root of documentation. Used to adjust relative links in the navbar.

encoding

The encoding of the input files.

quiet

Set to 'FALSE' to display output of knitr and pandoc. This is useful when debugging.

vignettes_directory

Name of vignettes directory (defaults to vignettes)

YAML config

To tweak the index page, you need a section called articles, which provides a list of sections containing, a title, list of contents, and optional description.

For example, this imaginary file describes some of the structure of the R markdown articles:

articles:
- title: R Markdown
  contents:
  - starts_with("authoring")
- title: Websites
  contents:
  - rmarkdown_websites
  - rmarkdown_site_generators

Note that contents can contain either a list of vignette names (including subdirectories), or if the functions in a section share a common prefix or suffix, you can use starts_with("prefix") and ends_with("suffix") to select them all. If you don't care about position within the string, use contains("word"). For more complex naming schemes you can use an aribrary regular expression with matches("regexp").

pkgdown will check that all vignettes are included in the index this page, and will generate a warning if you have missed any.

Supressing vignettes

If you want articles that are not vignettes, either put them in subdirectories or list in .Rbuildignore. An articles link will be automatically added to the default navbar if the vignettes directory is present: if you do not want this, you will need to customise the navbar. See build_site details.


CenterForAssessment/packagePages documentation built on May 31, 2022, 1:56 p.m.