11

Does knitr know the value of YAML data e.g. title: or date: or some_custom_field: while it is compiling an rmarkdown doc with a YAML header?

I would like to be able to do this (pseudocode)

---
title: my title
---

The title of this document is `r knitrs_yaml_array("title")`
Steve Powell
  • 1,556
  • 15
  • 23

1 Answers1

16

That is stored in rmarkdown::metadata as a list of the form list(title = ...).

baptiste
  • 73,538
  • 17
  • 190
  • 281
Yihui Xie
  • 26,509
  • 22
  • 178
  • 407
  • Is there a way to modify `rmarkdown::metadata` on the fly? Within a report constructed from modules/child documents , I would like to augment the abstract module-specific as the module is evaluated (or not). – balin May 28 '18 at 08:57