read_md: Read markdown-formatted metadata

View source: R/read_md.R

read_mdR Documentation

Read markdown-formatted metadata

Description

read_md() imports metadata from a markdown file into the workspace as a tibble.

Usage

read_md(file)

Arguments

file

Filename to read from. Must be either .Rmd or .qmd file.

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 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().

Value

read_md() returns an object of class tbl_df, tbl and data.frame (i.e. a tibble).

Examples

source_file <- system.file("extdata", 
                           "bionet_metadata.Rmd",
                           package = "delma")
read_md(source_file)

delma documentation built on June 8, 2025, 1:56 p.m.