renderer: Create a function to render R Markdown with pre-filled...

Description Usage Arguments Details Value Functions See Also

Description

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.

Usage

1
2
3
4
5

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.

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():

1
2
3
4
5
6
---
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:

1
2
3
4
5
6
7
---
title: "Crop Analysis Q3 2013"
author: Martha Smith
date: October 23rd, 2013
knit: |
  rmdmatter::renaming_renderer(function(metadata) metadata$title)
---

Value

A function that takes two arguments, input and encoding, and renders the input R Markdown document when called.

Functions

See Also

rmarkdown::render() used by rmarkdown_renderer().

render() used by rmdmatter_renderer().

render_and_rename() used by renaming_renderer().


mikmart/rmdmatter documentation built on Feb. 28, 2022, 12:47 a.m.