Data is passed to a template to render the final document.

render(.x, ...)

# S3 method for character
render(.x, ..., .config = default_config())

# S3 method for fs_path
render(.x, ..., .config = default_config())

# S3 method for jinjar_template
render(.x, ...)

Arguments

.x

The template. Choices:

...

<dynamic-dots> Data passed to the template.

.config

The engine configuration. The default matches Jinja defaults, but you can use jinjar_config() to customize things like syntax delimiters, whitespace control, and loading auxiliary templates.

Value

String containing rendered template.

See also

Examples

# pass data as arguments
render("Hello {{ name }}!", name = "world")
#> [1] "Hello world!"

# pass data as list
params <- list(name = "world")
render("Hello {{ name }}!", !!!params)
#> [1] "Hello world!"

# render template file
if (FALSE) {
render(fs::path("template.txt"), name = "world")
}