Add an HTML body to a message object.
html(
msg,
content,
disposition = "inline",
charset = "utf-8",
encoding = NA,
css_files = c(),
language = FALSE,
interpolate = TRUE,
.open = "{{",
.close = "}}",
.envir = NULL
)
A message object.
A string of message content.
Should the content be displayed inline or as an
attachment? Valid options are "inline"
and "attachment"
. If
set to NA
then will guess appropriate value.
What character set is used. Most often either "UTF-8"
or "ISO-8859-1"
.
How content is transformed to ASCII. Options are
"7bit"
, "quoted-printable"
and "base64"
. Use NA
or NULL
for no (or "identity") encoding.
Extra CSS files.
Language of content. If FALSE
then will not include
language field. If TRUE
then will attempt to auto-detect language.
Otherwise will use the specified language.
Whether or not to interpolate into input using glue.
The opening delimiter.
The closing delimiter.
Environment used for glue
interpolation. Defaults to parent.frame()
.
A message object.
# Inline HTML message.
envelope() %>% html("<b>Hello!</b>")
# Read HTML message from a file.
htmlfile <- tempfile(fileext = ".html")
cat("<p>Hello!</p>\n", file = htmlfile)
envelope() %>% html(htmlfile)
# You can pass a vector of character. Components will be separated by a
# "\n".
envelope() %>% html(c("<b>Hello</b>", "<p>World!</p>"))
# You can also pass a tagList from {htmltools}.
if (requireNamespace("htmltools", quietly = TRUE)) {
library(htmltools)
envelope() %>% html(tagList(h2("Hello"), p("World!")))
}