Render a single qmd file to html with image folder.
Usage
render_single_qmd(
qmd,
img_root_dir = "img",
output_format = "revealjs",
metadata = NULL,
quiet = TRUE
)
Arguments
- qmd
character. Path to the qmd file to render
- img_root_dir
character. Path to the main image folder to extract media to
- output_format
character. Output format of the qmd, default to "revealjs". Can be adapted for specific themes.
- metadata
list. List of metadata to be used for rendering single qmd file
- quiet
logical. Output info in user console
Examples
# create a temp dir with qmd
temp_dir <- tempfile(pattern = "render")
dir.create(
path = file.path(temp_dir, "img"),
recursive = TRUE
)
file.copy(
from = system.file("courses", "M01", "M01S01", "C01-qmd1_for_test.qmd", package = "squash"),
to = temp_dir
)
#> [1] TRUE
file.copy(
from = system.file("courses", "M01", "M01S01", "img", "logo_1.png", package = "squash"),
to = file.path(temp_dir, "img")
)
#> [1] TRUE
# render qmd
is_rendered <- render_single_qmd(
qmd = file.path(temp_dir, "C01-qmd1_for_test.qmd"),
img_root_dir = file.path(temp_dir, "image_folder")
)
# clean temp dir
unlink(temp_dir, recursive = TRUE)