knitr-hooks: Callbacks for knitr.

Description Usage Arguments See Also Examples

Description

ansi_handler converts ANSI color codes to HTML tags; this is the callback for knitr, see ansi_to_html for the actual implementation.

create_trimming_hook Creates an output callback function (hook) for knitr. When registered, it gets triggered by the output.lines option passed in a knitr's code snippet. See this Stack Overflow question for more details.

Usage

1
2
3

Arguments

x

Text snippet.

options

options.

output_hook

knitr's output hook used to print the transformed output.

See Also

ansi_to_html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
knitr::knit_hooks$set(output = ansi_handler)
knitr::knit_hooks$set(message = ansi_handler)

## End(Not run)
## Not run: 
output_hook <- knit_hooks$get("output")
trimming_hook <- create_trimming_hook(output_hook)
knit_hooks$set(output = trimming_hook)

## End(Not run)

lbartnik/utilities documentation built on May 3, 2019, 11:52 p.m.