markdownToHTML transforms the markdown text provided by the
user in either the file or text variable. The HTML
transformation is either written to the output file or returned to the
user as a character vector.markdownToHTML(file, output, text,
options = getOption("markdown.HTML.options"),
extensions = getOption("markdown.extensions"), title = "",
stylesheet = getOption("markdown.HTML.stylesheet"),
header = getOption("markdown.HTML.header"),
template = getOption("markdown.HTML.template"), fragment.only = FALSE)text argument
will be used instead.raw vector.markdownHTMLOptions.markdownExtensions.renderMarkdown returns NULL invisibly when output is to a
file, and a character vector otherwise.See the DETAILS section below and markdownHTMLOptions for more
information.
There are two basic modes to markdownToHTML determined by the value of
the fragment.only argument:
When FALSE, markdownToHTML creates well-formed stand-alone HTML
pages complete with HTML header, title, and body tags. The default template
used for this mode may be found here:
system.file('resources', 'markdown.html', package = 'markdown')
Also, markdownToHTML will automatically determine whether or not
mathjax and R code highlighting are needed and will include the appropriate
Javascript libraries in the output. Thus, there's no need to explicitly set
the 'mathjax' or 'highlight_code' options (see
markdownHTMLOptions for more details).
When fragment.only is TRUE, nothing extra is added.
markdownExtensions, markdownHTMLOptions,
renderMarkdown.print(markdownToHTML(text = "Hello World!"))Run the code above in your browser using DataLab