mark | R Documentation |
Render Markdown to an output format via the commonmark package. The
function mark_html()
is a shorthand of mark(format = 'html', template = TRUE)
, and mark_latex()
is a shorthand of mark(format = 'latex', template = TRUE)
.
mark(
file = NULL,
output = NULL,
text = NULL,
format = c("html", "latex"),
options = NULL,
template = FALSE,
meta = list()
)
mark_html(..., template = TRUE)
mark_latex(..., template = TRUE)
file |
Path to an input file. If not provided, it is presumed that the
|
output |
Output file path. If not character, the results will be
returned as a character vector. If not specified and the input is a file
path, the output file path will have the same base name as the input file,
with an extension corresponding to the |
text |
A character vector of the Markdown text. By default, it is read
from |
format |
An output format supported by commonmark, e.g., |
options |
Options to be passed to the renderer. See |
template |
Path to a template file. The default value is
|
meta |
A named list of metadata. Elements in the metadata will be used
to fill out the template by their names and values, e.g., |
... |
Arguments to be passed to |
Invisible NULL
when output is to a file, otherwise a character
vector of the rendered output.
The spec of GitHub Flavored Markdown: https://github.github.com/gfm/
library(markdown)
mark(c("Hello _World_!", "", "Welcome to **markdown**."))
# a few corner cases
mark(character(0))
mark("")
# if input happens to be a file path but should be treated as text, use I()
mark(I("This is *not* a file.md"))
# that's equivalent to
mark(text = "This is *not* a file.md")
mark_html("Hello _World_!", template = FALSE)
# write HTML to an output file
mark_html("_Hello_, **World**!", output = tempfile())
mark_latex("Hello _World_!", template = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.