rmd_template: Create a template from an 'rmd' object.

Description Usage Arguments Value Examples

View source: R/rmd_template.R

Description

Templates are objects which are meant to capture the structure of an R Markdown document and facilitate the comparison between the template and new Rmd documents, usually to ensure the structure and/or content matches sufficiently.

Usage

1
2
3
4
5
6
7
8
rmd_template(
  rmd,
  keep_content = FALSE,
  keep_labels = TRUE,
  keep_headings = FALSE,
  keep_yaml = FALSE,
  ...
)

Arguments

rmd

R Markdown document in the form of an rmd_ast or rmd_tibble.

keep_content

Should the template keep the document's content (markdown text and chunk code).

keep_labels

Should the template keep the document's code chunk labels.

keep_headings

Should the template keep the document's headings.

keep_yaml

Should the template keep the document's yaml.

...

Unused, for extensibility.

Value

Returns an rmd_template object, which is a derived tibble containing relevant structural details of the document.

Examples

1
2
3
4
rmd = parse_rmd(system.file("hw01.Rmd", package="parsermd"))

rmd_select(rmd, by_section(c("Exercise *", "Solution"))) %>%
  rmd_template()

parsermd documentation built on May 20, 2021, 5:08 p.m.