如何从 knitr 访问 yaml 元数据

how to access yaml metadata from knitr

knitr 是否知道 YAML 数据的值,例如title: or date: or some_custom_field: while it is compiling an rmarkdown doc with a YAML header?

我希望能够做到这一点(伪代码)

---
title: my title
---

The title of this document is `r knitrs_yaml_array("title")`

作为 list(title = ...).

形式的列表存储在 rmarkdown::metadata