This function compares the provided Rmd against a template and reports on discrepancies (e.g. missing or unmodified components).
Arguments
- rmd
The rmd to be check, can be an
rmd_ast
,rmd_tibble
, or text that can be handled byparse_rmd
.- template
rmd_template
object fromrmd_template()
.- ...
Unused, for extensibility.
Examples
tmpl = parse_rmd(system.file("examples/hw01.Rmd", package = "parsermd")) %>%
rmd_select(by_section(c("Exercise *", "Solution"))) %>%
rmd_template(keep_content = TRUE)
rmd_check_template(
system.file("examples/hw01-student.Rmd", package = "parsermd"),
tmpl
)
#> ✖ The following required elements were missing in the document:
#> • Section "Exercise 3" > "Solution" is missing required "markdown text".
#> • Section "Exercise 3" > "Solution" is missing required "markdown text".
#>
#> ✖ The following document elements were unmodified from the template:
#> • Section "Exercise 2" > "Solution" has a "code chunk" named "plot-dino"
#> which has not been modified.
#> • Section "Exercise 2" > "Solution" has "markdown text" which has not been
#> modified.
#> • Section "Exercise 2" > "Solution" has a "code chunk" named "cor-dino"
#> which has not been modified.