
This is a convenience function to knit the input markdown source and call
markdownToHTML()
in the markdown package to
convert the result to HTML.
knit2html(input, output = NULL, ..., envir = parent.frame(), text = NULL, quiet = FALSE,
encoding = getOption("encoding"), force_v1 = FALSE)
path of the input file
path of the output file for knit()
; if NULL
, this
function will try to guess and it will be under the current working
directory
options passed to markdownToHTML
the environment in which the code chunks are to be evaluated
(for example, parent.frame()
, new.env()
, or
globalenv()
)
a character vector as an alternative way to provide the input file
whether to suppress the progress bar and messages
the encoding of the input file; see file
whether to force rendering the input document as an R Markdown v1 document (even if it is for v2)
If the argument text
is NULL, a character string (HTML code)
is returned; otherwise the result is written into a file and the filename
is returned.
# NOT RUN {
# a minimal example
writeLines(c("# hello markdown", "```{r hello-random, echo=TRUE}", "rnorm(5)", "```"),
"test.Rmd")
knit2html("test.Rmd")
if (interactive()) browseURL("test.html")
# }
Run the code above in your browser using DataLab