A utility function that renders either R Markdown or Quarto reports based
on the specified format. Validates and cleans parameters, resolves the
template path (creating a fallback if needed), delegates to the
appropriate renderer, and writes a self-contained HTML error page if
rendering fails.
Usage
render_report(
format = c("rmarkdown", "quarto"),
output_file,
params = list(),
template_path = NULL
)
Arguments
- format
Character string: "rmarkdown" or "quarto".
- output_file
Path to the output file.
- params
Named list of parameters to pass to the report template.
- template_path
Optional custom template path. When NULL
(default), the bundled template for format is used.
Value
The path to the rendered (or error-fallback) file, invisibly.