Set or get output hooks for different output formats
The render_*()
functions set built-in output hooks for LaTeX, HTML,
Markdown, reStructuredText, AsciiDoc, and Textile. The hooks_*()
functions return a list of the output hooks for the corresponding format.
render_html() hooks_html() render_asciidoc() hooks_asciidoc() render_latex() hooks_latex() render_sweave() hooks_sweave(envirs = c("Sinput", "Soutput", "Schunk")) render_listings() hooks_listings(envirs = c("Sinput", "Soutput", "Schunk")) render_markdown(strict = FALSE, fence_char = "`") hooks_markdown(strict = FALSE, fence_char = "`") render_jekyll(highlight = c("pygments", "prettify", "none"), extra = "") hooks_jekyll(highlight = c("pygments", "prettify", "none"), extra = "") render_rst(strict = FALSE) hooks_rst(strict = FALSE) render_textile() hooks_textile()
envirs |
Names of LaTeX environments for code input, output, and chunk. |
strict |
Boolean; whether to use strict markdown or reST syntax. For markdown, if
|
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 |
extra |
Extra tags for the highlighting engine. For |
There are three variants of Markdown documents: ordinary Markdown
(render_markdown(strict = TRUE)
, which calls
hooks_markdown(strict = TRUE)
), extended Markdown (e.g., GitHub
Flavored Markdown and Pandoc; render_markdown(strict = FALSE)
, which
calls hooks_markdown(strict = FALSE)
), and Jekyll (a blogging system
on GitHub; render_jekyll()
, which calls hooks_jekyll()
).
For LaTeX output, there are three variants: knitr's default style
(render_latex()
, which calls hooks_latex()
and uses the LaTeX
framed package), Sweave style (render_sweave()
, which calls
hooks_sweave()
and uses ‘Sweave.sty’), and listings style
(render_listings()
, which calls hooks_listings()
and uses LaTeX
listings package).
Default HTML output hooks are set by render_html()
(which calls
hooks_html()
); render_rst()
(which calls hooks_rst()
) is
for reStructuredText; render_textile()
(which calls
hooks_textile()
) is for Textile, and render_asciidoc()
(which
calls hooks_asciidoc()
) is AsciiDoc.
The render_*()
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 also use knit_hooks
to set the format's hooks with the
hooks_*()
functions; see references for more info on further
customizing output hooks.
NULL
for render_*
functions; corresponding hooks are
set as a side effect. A list of output hooks for hooks_*()
functions.
See output hooks in https://yihui.org/knitr/hooks/, and some examples in https://bookdown.org/yihui/rmarkdown-cookbook/output-hooks.html
Jekyll and Liquid: https://github.com/jekyll/jekyll/wiki/Liquid-Extensions; prettify.js: https://code.google.com/archive/p/google-code-prettify
# below is pretty much what knitr::render_markdown() does: knitr::knit_hooks$set(knitr::hooks_markdown()) # you can retrieve a subset of the hooks and set them, e.g., knitr::knit_hooks$set(knitr::hooks_markdown()["source"]) knitr::knit_hooks$restore()
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.