https://github.com/rundel/parsermd
https://github.com/rundel/parsermd
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rundel/parsermd
- Owner: rundel
- License: other
- Created: 2020-08-10T09:26:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-18T04:15:05.000Z (about 1 year ago)
- Last Synced: 2024-01-18T11:13:12.307Z (about 1 year ago)
- Language: R
- Homepage: https://rundel.github.io/parsermd/
- Size: 4.32 MB
- Stars: 71
- Watchers: 4
- Forks: 4
- Open Issues: 12
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - rundel/parsermd - (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README",
out.width = "100%"
)options(width = 80)
```# parsermd
[](https://CRAN.R-project.org/package=parsermd)
[](https://github.com/rundel/parsermd/actions/workflows/R-CMD-check.yaml)The goal of parsermd is to extract the content of an R Markdown file to allow for programmatic interactions with the document's contents (i.e. code chunks and markdown text). The goal is to capture the fundamental structure of the document and as such we do not attempt to parse every detail of the Rmd. Specifically, the yaml front matter, markdown text, and R code are read as text lines allowing them to be processed using other tools.
## Installation
`parsermd` can be installed from CRAN with:
```r
install.packages("parsermd")
```You can install the latest development version of `parsermd` from [GitHub](https://github.com/rundel/parsermd) with:
```r
remotes::install_github("rundel/parsermd")
``````{r}
library(parsermd)
```## Basic Usage
For more details see the getting started [vignette](https://rundel.github.io/parsermd/articles/parsermd.html) or any of the topic specific articles.
```{r example}
(rmd = parsermd::parse_rmd(system.file("examples/minimal.Rmd", package = "parsermd")))as_tibble(rmd)
rmd_select(rmd, by_section("Content"))
rmd_select(rmd, by_section(c("Content", "*"))) |>
rmd_select(has_type(c("rmd_chunk", "rmd_heading")))rmd_select(rmd, "pressure")
rmd_select(rmd, 1:3)
```