The returned function is compatible with the knit
YAML front matter field
in R Markdown documents, which lets you customize the Knit
button in RStudio.
Arguments
- ...
Arguments passed to the underlying rendering function when the returned function is called.
- callback
A function that gets the rendered R Markdown YAML front matter metadata as an argument, and returns a new name for
file
. Any changes implied to the directory or file extension are ignored -- only the name is changed.
Value
A function that takes two arguments, input
and encoding
, and
renders the input
R Markdown document when called.
Details
Renderer functions are particularly useful in conjunction with the knit
metadata field to specify custom rendering options in RStudio. For example,
extending the example header in rmarkdown::rmd_metadata, you can easily
specify a fixed output file with rmarkdown_renderer()
:
---
title: "Crop Analysis Q3 2013"
author: Martha Smith
date: October 23rd, 2013
knit: rmdmatter::rmarkdown_renderer(output_file = "analysis-q3")
---
Or use renaming_renderer()
to name the output dynamically using fields in
the front matter:
---
title: "Crop Analysis Q3 2013"
author: Martha Smith
date: October 23rd, 2013
knit: |
rmdmatter::renaming_renderer(function(metadata) metadata$title)
---
Functions
rmarkdown_renderer
: Vanilla R Markdown rendering.rmdmatter_renderer
: Retains the rendered YAML front matter.renaming_renderer
: Retains the rendered YAML front matter, and passes it tocallback
to rename the output file.
See also
rmarkdown::render()
used by rmarkdown_renderer()
.
render()
used by rmdmatter_renderer()
.
render_and_rename()
used by renaming_renderer()
.