Documents are parse into an rmd_ast object.

parse_rmd(rmd, allow_incomplete = FALSE, parse_yaml = TRUE)

Arguments

rmd

Either the path to an Rmd file or a character vector containing the contents of a R Markdown document.

allow_incomplete

Allow incomplete parsing of the document.

parse_yaml

Use the yaml package to parse the document's yaml.

Value

Returns a rmd_ast object.

Examples

parse_rmd(system.file("hw01.Rmd", package="parsermd"))
#> ├── YAML [2 lines] #> ├── Heading [h3] - Load packages #> │ └── Chunk [r, 1 opt, 2 lines] - load-packages #> ├── Heading [h3] - Exercise 1 #> │ ├── Markdown [2 lines] #> │ └── Heading [h4] - Solution #> │ └── Markdown [2 lines] #> ├── Heading [h3] - Exercise 2 #> │ ├── Markdown [2 lines] #> │ └── Heading [h4] - Solution #> │ ├── Markdown [4 lines] #> │ ├── Chunk [r, 2 opts, 5 lines] - plot-dino #> │ ├── Markdown [2 lines] #> │ └── Chunk [r, 2 lines] - cor-dino #> └── Heading [h3] - Exercise 3 #> ├── Markdown [2 lines] #> └── Heading [h4] - Solution #> ├── Markdown [4 lines] #> ├── Chunk [r, 1 lines] - plot-star #> ├── Markdown [2 lines] #> └── Chunk [r, 1 lines] - cor-star