render_html | R Documentation |
This uses rmarkdown::pandoc_convert()
to render HTML from a markdown file.
We've specified pandoc extensions that align with the features desired in the
Carpentries such as markdown_in_html_blocks
, tex_math_dollars
, and
native_divs
.
render_html(path_in, ..., quiet = FALSE)
path_in |
path to a markdown file |
... |
extra options (e.g. lua filters) to be passed to pandoc |
quiet |
if |
a character containing the rendred HTML file
if (rmarkdown::pandoc_available("2.11")) {
# first example---markdown to HTML
tmp <- tempfile()
ex <- c("# Markdown",
"",
"::: challenge",
"",
"How do you write markdown divs?",
"",
":::"
)
writeLines(ex, tmp)
cat(sandpaper:::render_html(tmp))
# adding a lua filter
lua <- tempfile()
lu <- c("Str = function (elem)",
" if elem.text == 'markdown' then",
" return pandoc.Emph {pandoc.Str 'mowdrank'}",
" end",
"end")
writeLines(lu, lua)
lf <- paste0("--lua-filter=", lua)
cat(sandpaper:::render_html(tmp, lf))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.