Title: | 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. |
Authors: | Sebastien Rochette [aut, cre] , ThinkR [cph] |
Maintainer: | Sebastien Rochette <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0.9000 |
Built: | 2024-12-03 04:56:37 UTC |
Source: | https://github.com/ThinkR-open/lightparser |
Combine a parsed tbl Rmd / Qmd file into a new file
combine_tbl_to_file(parsed_tbl, output_file)
combine_tbl_to_file(parsed_tbl, output_file)
parsed_tbl |
A tibble with columns as issued by |
output_file |
A Rmd / Qmd file path to write the new content |
The content of a Rmd / Qmd file as character and the resulting file if output_file is provided.
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"))
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
split_to_tbl(file)
split_to_tbl(file)
file |
A Rmd or Qmd file path |
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)
file <- system.file( "dev-template-parsing.Rmd", package = "lightparser" ) split_to_tbl(file)
file <- system.file( "dev-template-parsing.Rmd", package = "lightparser" ) split_to_tbl(file)