render_html {knitr} | R Documentation

## Set output hooks for different output formats

### Description

These functions set built-in output hooks for LaTeX, HTML, Markdown, reStructuredText, AsciiDoc and Textile.

### Usage

    render_html()

    render_asciidoc()

    render_latex()

    render_sweave()

    render_listings()

    render_markdown(strict = FALSE, fence_char = "`")

    render_jekyll(highlight = c("pygments", "prettify", "none"), extra = "")

    render_rst(strict = FALSE)

    render_textile()

### Arguments

`strict` | Boolean; whether to use strict markdown or reST syntax. For markdown, if `TRUE`, code blocks will be indented by 4 spaces, otherwise they are put in fences made by three backticks. For reST, if `TRUE`, code is put under two colons and indented by 4 spaces, otherwise it is put under the sourcecode directive (this is useful for e.g. Sphinx).
`fence_char` | A single character to be used in the code blocks fence. This can be e.g. a backtick or a tilde, depending on your Markdown rendering engine.
`highlight` | Which code highlighting engine to use: if `pygments`, the Liquid syntax is used (default approach Jekyll); if `prettify`, the output is prepared for the JavaScript library ‘prettify.js’; if `none`, no highlighting engine will be used, and code blocks are simply indented by 4 spaces).
`extra` | Extra tags for the highlighting engine. For `pygments`, this can be `'linenos'`; for `prettify`, it can be `'linenums'`.

### Details

There are three variants of markdown documents: ordinary markdown (`render_markdown(strict = TRUE)`), extended markdown (e.g. GitHub Flavored Markdown and pandoc; `render_markdown(strict = FALSE)`), and Jekyll (a blogging system on GitHub; `render_jekyll()`). For LaTeX output, there are three variants as well: knitr's default style (`render_latex()`; use the LaTeX framed package), Sweave style (`render_sweave()`; use ‘Sweave.sty’) and listings style (`render_listings()`; use LaTeX listings package). Default HTML output hooks are set by `render_html()`; `render_rst()` and `render_asciidoc()` are for reStructuredText and AsciiDoc respectively.

These functions can be used before `knit()` or in the first chunk of the input document (ideally this chunk has options `include = FALSE` and `cache = FALSE`) so that all the following chunks will be formatted as expected.

You can use `knit_hooks` to further customize output hooks; see references.

### Value

`NULL`; corresponding hooks are set as a side effect

### References

See output hooks in https://yihui.name/knitr/hooks/.

Jekyll and Liquid: https://github.com/jekyll/jekyll/wiki/Liquid-Extensions; prettify.js: http://code.google.com/p/google-code-prettify/

[Package knitr version 1.22 Index]