It's generally better to specify Table of Contents in the output function you are using so you have a clearer idea of your options (e.g. html_document(toc = TRUE, toc_float = TRUE)). However, you can also generally specify at the top level of YAML.

yml_toc(
  .yml,
  toc = yml_blank(),
  toc_depth = yml_blank(),
  toc_title = yml_blank(),
  ...
)

Arguments

.yml

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

toc

Logical. Use a Table of Contents?

toc_depth

An integer. The depth of headers to use in the TOC. Note that the actual YAML field is toc-depth.

toc_title

The title of the TOC. Note that the actual YAML field is toc-title.

...

additional named R objects, such as characters or lists, to transform into YAML

Value

a yml object

See also

Examples

yml() %>% yml_toc(toc = TRUE, toc_depth = 1, toc_title = "Article Outline")
#> --- #> author: runner #> date: '`r format(Sys.Date())`' #> toc: true #> toc-depth: 1.0 #> toc-title: Article Outline #> --- #>