renderMarkdown {markdown}R Documentation

Render markdown to an HTML fragment


renderMarkdown transforms the markdown text provided by the user in either the file or text variable. The transformation is either written to the output file or returned to the user. The default rendering target is "HTML".


renderMarkdown(file, output = NULL, text = NULL, renderer = "HTML", 
    renderer.options = NULL, extensions = getOption("markdown.extensions"), 
    encoding = getOption("encoding"))



a character string giving the pathname of the file to read from. If it is omitted from the argument list, then it is presumed that the text argument will be used instead.


a character string giving the pathname of the file to write to. If it is omitted (NULL), then it is presumed that the user expects the results returned as a character vector.


a character vector containing the markdown text to transform (each element of this vector is treated as a line in a file).


the name of the renderer that will be used to transform the file or text.


options that are passed to the renderer. For HTML renderer options see markdownHTMLOptions.


options that are passed to the markdown engine. See markdownExtensions.


the encoding of the input file; see file


markdown uses (and ships with) the popular Sundown library provided by GitHub. C stubs are available to implement new renderers.


renderMarkdown returns NULL invisibly when output is to a file, and either character (with the UTF-8 encoding) or raw vector depending on the renderer output type.

See Also

markdownExtensions, markdownHTMLOptions, markdownToHTML.

For a description of the original markdown version:

The original Sundown library on github:

C stubs for writing new renders are in inst/include/markdown_rstubs.[ch].


(renderMarkdown(text = "Hello World!"))
# a few corner cases
(renderMarkdown(text = character(0)))
(renderMarkdown(text = ""))

[Package markdown version 0.8.1 Index]