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.

  toc = yml_blank(),
  toc_depth = yml_blank(),
  toc_title = yml_blank(),



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


Logical. Use a Table of Contents?


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


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


a yml object

See also


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 #> --- #>