knit2html

0th

Percentile

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

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, output = NULL, ..., envir = parent.frame(),
  text = NULL, quiet = FALSE, encoding = "UTF-8", force_v1 = FALSE)
Arguments
input

Path to the input file.

output

Path to the output file for knit(). If NULL, this function will try to guess a default, which will be under the current working directory.

...

Options passed to markdownToHTML.

envir

Environment in which code chunks are to be evaluated, for example, parent.frame(), new.env(), or globalenv()).

text

A character vector. This is an alternative way to provide the input file.

quiet

Boolean; suppress the progress bar and messages?

encoding

Encoding of the input file; always assumed to be UTF-8 (i.e., this argument is effectively ignored).

force_v1

Boolean; whether to force rendering the input document as an R Markdown v1 document, even if it is for v2.

Value

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.

Note

The markdown package is for R Markdown v1, which is much less powerful than R Markdown v2, i.e. the rmarkdown package (https://rmarkdown.rstudio.com). To render R Markdown v2 documents to HTML, please use rmarkdown::render() instead.

See Also

knit, markdownToHTML

Aliases
  • knit2html
Examples
# 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")

unlink(c("test.Rmd", "test.html", "test.md"))
# }
Documentation reproduced from package knitr, version 1.26, License: GPL

Community examples

Looks like there are no examples yet.