yml_output() writes valid YAML for the output field of R Markdown YAML. yml_output() captures the actual output functions, such as pdf_document(), and translates them to YAML. This function accepts multiple output formats (separated by commas) and validates each by evaluating the function internally. The YAML fields in under output come from arguments in their respective R functions. If you wanted to see the available fields in pdf_document(), for instance, you would read the documentation for that function using ?pdf_document.

yml_output(.yml, ...)



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


valid R code calling functions that return objects of class rmarkdown_output_format, such as the *_document() functions in rmarkdown.


a yml object

See also


# \donttest{ yml()
#> --- #> author: Malcolm Barrett #> date: '`r format(Sys.Date())`' #> --- #>
#> Error in html_document(): could not find function "html_document"
#> --- #> author: Malcolm Barrett #> date: '`r format(Sys.Date())`' #> --- #>
yml_output( pdf_document(keep_tex = TRUE, includes = includes2(after_body = "footer.tex")), bookdown::html_document2() )
#> Error in pdf_document(keep_tex = TRUE, includes = includes2(after_body = "footer.tex")): could not find function "pdf_document"
# }