Render either Plain Markdown or R Markdown directly into the body of an email.

If input is a file then it will be interpreted as R Markdown it its extension is either "Rmd" or "Rmarkdown". Otherwise it will be processed as Plain Markdown.

  params = NULL,
  squish = TRUE,
  css_files = c(),
  include_css = c("rmd", "bootstrap", "highlight"),
  language = FALSE,
  interpolate = TRUE,
  .open = "{{",
  .close = "}}",
  .envir = NULL



A message object.


The input Markdown file to be rendered or a character vector of Markdown text.


A list of named parameters that override custom parameters specified in the YAML front-matter.


Whether to clean up whitespace in rendered document.


Extra CSS files.


Whether to include rendered CSS from various sources ("rmd" — native R Markdown CSS; "bootstrap" — Bootstrap CSS; "highlight" — highlight.js CSS).


Langauge 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.

Plain Markdown

Plain Markdown is processed with commonmark::markdown_html().

R Markdown

R Markdown is processed with rmarkdown::render().

Regardless of what output type is specified in the input file, render() will always use the "html_document" output format.


# Plain Markdown markdown <- "[This]( is a link." filename <- "" # Render from Markdown in character vector. msg <- envelope() %>% render(markdown) # Create a file containing Markdown cat(markdown, file = filename) # Render from Markdown in file. msg <- envelope() %>% render(filename) # Cleanup. file.remove(filename)
#> [1] TRUE
# R Markdown filename <- "gh-doc.Rmd" # Create an Rmd document from template. rmarkdown::draft( filename, template = "github_document", package = "rmarkdown", edit = FALSE ) # Check for suitable version of Pandoc ( # # Need to have version 2.0 or greater to support required --quiet option. # pandoc <- rmarkdown::find_pandoc() suitable_pandoc <- !is.null(pandoc$dir) && grepl("^2", pandoc$version) # Render from Rmd file. if (suitable_pandoc) { msg <- envelope() %>% render(filename, include_css = c("rmd", "highlight")) } # Cleanup. file.remove(filename)
#> [1] TRUE