knitr (version 1.1)

knit2html: Convert markdown to HTML using knit() and markdownToHTML()

Description

This is a convenience function to knit the input markdown source and call markdownToHTML() in the markdown package to convert the result to HTML.

Usage

knit2html(input, ..., text = NULL, encoding = getOption("encoding"))

Arguments

...
options passed to markdownToHTML
input
path of the input file
text
a character vector as an alternative way to provide the input file
encoding
the encoding of the input file; see file

Value

  • If the argument text is NULL, a character string (HTML code) is returned; otherwise the result is written into a file and NULL is returned.

See Also

knit, markdownToHTML

Examples

Run this code
# a minimal example
writeLines(c("# hello markdown", "```{r hello-random, echo=TRUE}", "rnorm(5)", "```"), 
    "test.Rmd")
if (require("markdown")) {
    knit2html("test.Rmd")
    if (interactive()) 
        browseURL("test.html")
}

Run the code above in your browser using DataLab