Extracts the YAML metadata block (between --- delimiters) from a .qmd or
.md file. This is the primary way to programmatically inspect document
metadata before generation or validation. Returns NULL when frontmatter is
absent, allowing callers to distinguish "no metadata" from "empty metadata."
Value
A named list of frontmatter fields, or NULL if the file contains
no valid ----delimited YAML block.
See also
Other extraction:
parse_quarto_body()
Examples
path <- tempfile(fileext = ".qmd")
writeLines(c(
"---",
"title: Guide",
"description: How to use the platform.",
"---",
"",
"Content here."
), path)
fm <- parse_quarto_yaml(path)
fm$title
#> [1] "Guide"
fm$description
#> [1] "How to use the platform."