render_chunk: Render chunk output with classes in Xaringan (for remark.js)

Description Usage Arguments Details Value Examples

Description

Reasonably savvy in selecting the right option for your output.

Usage

1
render_chunk(x, options, inline = FALSE, ...)

Arguments

x

Character. Chunk output.

options

List. Options as passed from knitr.

inline

Logical. As passed from knitr. Is the result inline?

...

Other parameters passed from knitr.

Details

Currently the function uses render_html_chunk if the knitr output is an htmlwidget or knitr_kable. Otherwise, if results is set to "asis", it uses render_asis_chunk. For standard fenced output (beginning and ending with three backticks), surprisinglytidy relies on sassy.js to post-process Pandoc-syntax classes into remark.js classes.

Value

knitr object for printing.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# In \code{knitr} setup:
knitr::opts_chunk$set(         # first option tells knitr to use function
  render        = surprisinglytidy::render_chunk
  class.source  = ".r-source", # you can set each separately
  class.warning = ".r-warning",# class.output is what render_chunk will use
  class.message = ".r-message",# note that you can use multiple classes,
  class.error   = ".r-error",  # separated by a space
  class.output  = ".r-output .another-class"
)

## End(Not run)

BenjaminWolfe/surprisinglytidy documentation built on Nov. 22, 2019, 11:37 a.m.