read_md {delma}R 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)

[Package delma version 0.1.1 Index]