There's a fairly simple underlying bug here. Run interactively, the function inserts an extra hyphen into its output:
quarto::write_yaml_metadata_block(
list(
author = "John Doe",
date = "2025-03-01"
)
)
[1] "---\n- author: John Doe\n date: '2025-03-01'\n---\n"
attr(,"class")
[1] "knit_asis"
attr(,"knit_cacheable")
[1] NA