Get body and style
get_body_and_style.RdRender Rmarkdown file as html file and extract the html nodes corresponding to body and style without the script nodes.
Arguments
- path
Path to the Rmd file.
- add_extra_css
Add css files listed in Rmarkdown yaml (output: html_document: css: ...). Default to "no" to not add extra css files. The option "append" adds the content of the css file(s) to the default Rmd style. The option "replace" replaces the default Rmd style by the content of the css file(s).
Examples
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to = dir_tmp)
#> [1] TRUE
file.copy(from = system.file("examples/style.css", package = "odsrmd"), to = dir_tmp)
#> [1] TRUE
# browseURL(dir_tmp)
path <- paste0(dir_tmp, "/example_rmd.Rmd")
body_and_style <- get_body_and_style(path, add_extra_css = "no")