Insert inline Markdown — markdown

markdown(mds, extensions = TRUE, .noWS = NULL, ...)

Arguments

mds

A character vector of Markdown source to convert to HTML. If the vector has more than one element, a single-element character vector of concatenated HTML is returned.

extensions

Enable Github syntax extensions; defaults to TRUE.

.noWS

Character vector used to omit some of the whitespace that would normally be written around generated HTML. Valid options include before, after, and outside (equivalent to before and end).

...

Additional arguments to pass to commonmark::markdown_html(). These arguments are dynamic.

Description

This function accepts Markdown-syntax text and returns HTML that may be included in Shiny UIs.

Value

a character vector marked as HTML.

Details

Leading whitespace is trimmed from Markdown text with glue::trim(). Whitespace trimming ensures Markdown is processed correctly even when the call to markdown() is indented within surrounding R code.

By default, Github extensions are enabled, but this can be disabled by passing extensions = FALSE.

Markdown rendering is performed by commonmark::markdown_html(). Additional arguments to markdown() are passed as arguments to markdown_html()

Examples

ui <- fluidPage(
  markdown("
    # Markdown Example

    This is a markdown paragraph, and will be contained within a `<p>` tag
    in the UI.

    The following is an unordered list, which will be represented in the UI as
    a `<ul>` with `<li>` children:

    * a bullet
    * another

    [Links](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) work;
    so does *emphasis*.

    To see more of what's possible, check out [commonmark.org/help](https://commonmark.org/help).
    ")
)