Skip to contents

Documents are parsed into an rmd_ast object.

Usage

parse_rmd(rmd, allow_incomplete = FALSE)

parse_qmd(qmd, allow_incomplete = FALSE)

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.

qmd

Either the path to an qmd file or a character vector containing the contents of a Quarto document.

Value

Returns a rmd_ast object.

Examples

parse_rmd(system.file("examples/hw01.Rmd", package="parsermd"))
#> ├── YAML [2 fields]
#> ├── Heading [h3] - Load packages
#> │   └── Chunk [r, 1 option, 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 options, 5 lines] - plot-dino
#> │       ├── Markdown [2 lines]
#> │       └── Chunk [r, 0 options, 2 lines] - cor-dino
#> └── Heading [h3] - Exercise 3
#>     ├── Markdown [2 lines]
#>     └── Heading [h4] - Solution
#>         ├── Markdown [4 lines]
#>         ├── Chunk [r, 0 options, 1 line] - plot-star
#>         ├── Markdown [2 lines]
#>         └── Chunk [r, 0 options, 1 line] - cor-star