read_md()
imports metadata from a markdown file into the workspace as a
tibble
.
Details
read_md()
is unusual in that it calls rmarkdown::render()
or
quarto::quarto_render()
internally to ensure code blocks and snippets
are parsed correctly. This ensures dynamic content is rendered correctly in
the resulting EML
document, but makes this function considerably slower
than a standard import function. Conceptually, therefore, it is closer to a
renderer with output type tibble
than a traditional read_
function.
This approach has one unusual consequence; it prevents 'round-tripping' of
embedded code. That is, dynamic content written in code snippets within the
metadata statement is rendered to plain text in EML.
If that EML
document
is later re-imported to Rmd
using read_eml()
and write_md()
, formerly
dynamic content will be shown as plain text.
Internally, read_md()
calls lightparser::split_to_tbl()
.
Examples
if (FALSE) { # \dontrun{
use_metadata("example.Rmd")
df <- read_md("example.Rmd")
} # }