make_preknitter: Generate a function to run prior to knitting

View source: R/preprocessor.R

make_preknitterR Documentation

Generate a function to run prior to knitting

Description

redoc modifies R Markdown documents prior to knitting to capture and store document elements that will need to be restored later. It does this via a function passed to the pre_knit argument of rmarkdown::output_format(). make_preknitter generates this function from a list of wrapper functions.

Usage

make_preknitter(wrappers = list())

Arguments

wrappers

a list of wrapper functions.

Details

rmarkdown does not provide a mechanism to modify the file prior to knitting, so redoc accomplishes this by reaching up the call stack and modifying the environment in the rmarkdown::render() function. The function generated by make_preknitter will do this by generating the pre-processed R Markdown file and associated list of code chunks, adding these the list of intermediates for cleanup, and switching the document input to this pre-processed document.

Value

A function to be used in 'output_format(pre_knit = ...)“

Examples


make_preknitter(wrappers = list(htmlcommentwrap, latexwrap))

noamross/redoc documentation built on Aug. 7, 2022, 7:22 a.m.