Title: | From 'Rmarkdown' and 'Quarto' Files to Tibble and Back |
Version: | 0.1.0 |
Description: | Split your 'rmarkdown' or 'quarto' files by sections into a tibble: titles, text, chunks. Rebuild the file from the tibble. |
License: | MIT + file LICENSE |
URL: | https://github.com/ThinkR-open/lightparser, https://thinkr-open.github.io/lightparser/ |
BugReports: | https://github.com/ThinkR-open/lightparser/issues |
Imports: | knitr (≥ 1.35), rlang, tibble, utils, yaml |
Suggests: | callr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Config/fusen/version: | 0.6.0 |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
NeedsCompilation: | no |
Packaged: | 2024-01-24 10:52:11 UTC; seb44 |
Author: | Sebastien Rochette
|
Maintainer: | Sebastien Rochette <sebastien@thinkr.fr> |
Repository: | CRAN |
Date/Publication: | 2024-01-24 16:00:05 UTC |
lightparser: From 'Rmarkdown' and 'Quarto' Files to Tibble and Back
Description
Split your 'rmarkdown' or 'quarto' files by sections into a tibble: titles, text, chunks. Rebuild the file from the tibble.
Author(s)
Maintainer: Sebastien Rochette sebastien@thinkr.fr (ORCID)
Other contributors:
ThinkR [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/ThinkR-open/lightparser/issues
Combine a parsed tbl Rmd / Qmd file into a new file
Description
Combine a parsed tbl Rmd / Qmd file into a new file
Usage
combine_tbl_to_file(parsed_tbl, output_file)
Arguments
parsed_tbl |
A tibble with columns as issued by |
output_file |
A Rmd / Qmd file path to write the new content |
Value
The content of a Rmd / Qmd file as character and the resulting file if output_file is provided.
Examples
file <- system.file("dev-template-parsing.Rmd",
package = "lightparser"
)
# split first
tbl_rmd <- split_to_tbl(file)
# apply your filters
tbl_rmd_filtered <- tbl_rmd[-5, ]
# combine then
combine_tbl_to_file(tbl_rmd_filtered, tempfile(fileext = ".Rmd"))
Group lines of a Rmd or Qmd file by types in a tibble
Description
Group lines of a Rmd or Qmd file by types in a tibble
Usage
split_to_tbl(file)
Arguments
file |
A Rmd or Qmd file path |
Value
A tibble with 6 columns:
-
type
: type of the part (yaml, heading, inline, block) -
label
: label of the part (if any) -
params
: parameters of the part (if any) -
text
: text of the part (if any) -
code
: code of the part (if any) -
heading
: heading of the part (if any) -
heading_level
: level of the heading (if any) -
section
: section of the Rmd file, according to headings (if any)
Examples
file <- system.file(
"dev-template-parsing.Rmd",
package = "lightparser"
)
split_to_tbl(file)