13

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,646
  • 16
  • 26

1 Answers1

18

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

baptiste
  • 75,767
  • 19
  • 198
  • 294
Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
  • 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