| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/utils-conversion.R |
| 3 |
\name{knit2html} |
| 4 |
\alias{knit2html} |
| 5 |
\title{Convert markdown to HTML using knit() and mark_html()} |
| 6 |
\usage{ |
| 7 |
knit2html( |
| 8 |
input, |
| 9 |
output = NULL, |
| 10 |
..., |
| 11 |
envir = parent.frame(), |
| 12 |
text = NULL, |
| 13 |
quiet = FALSE, |
| 14 |
encoding = "UTF-8", |
| 15 |
force_v1 = getOption("knitr.knit2html.force_v1", FALSE) |
| 16 |
) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{input}{Path to the input file.} |
| 20 |
|
| 21 |
\item{output}{Path to the output file for \code{knit()}. If \code{NULL}, this |
| 22 |
function will try to guess a default, which will be under the current |
| 23 |
working directory.} |
| 24 |
|
| 25 |
\item{...}{Options passed to |
| 26 |
\code{markdown::\link[markdown]{mark_html}()}.} |
| 27 |
|
| 28 |
\item{envir}{Environment in which code chunks are to be evaluated, for |
| 29 |
example, \code{\link{parent.frame}()}, \code{\link{new.env}()}, or |
| 30 |
\code{\link{globalenv}()}).} |
| 31 |
|
| 32 |
\item{text}{A character vector. This is an alternative way to provide the |
| 33 |
input file.} |
| 34 |
|
| 35 |
\item{quiet}{Boolean; suppress the progress bar and messages?} |
| 36 |
|
| 37 |
\item{encoding}{Encoding of the input file; always assumed to be UTF-8 (i.e., |
| 38 |
this argument is effectively ignored).} |
| 39 |
|
| 40 |
\item{force_v1}{Boolean; whether to force rendering the input document as an |
| 41 |
R Markdown v1 document, even if it is for v2.} |
| 42 |
} |
| 43 |
\value{ |
| 44 |
If the argument \code{text} is NULL, a character string (HTML code) |
| 45 |
is returned; otherwise the result is written into a file and the filename |
| 46 |
is returned. |
| 47 |
} |
| 48 |
\description{ |
| 49 |
This is a convenience function to knit the input markdown source and call |
| 50 |
\code{markdown::\link[markdown]{mark_html}()} in the \pkg{markdown} |
| 51 |
package to convert the result to HTML. |
| 52 |
} |
| 53 |
\note{ |
| 54 |
The \pkg{markdown} package is for R Markdown v1, which is much less |
| 55 |
powerful than R Markdown v2, i.e. the \pkg{rmarkdown} package |
| 56 |
(\url{https://rmarkdown.rstudio.com}). To render R Markdown v2 documents to |
| 57 |
HTML, please use \code{rmarkdown::render()} instead. |
| 58 |
} |
| 59 |
\examples{ |
| 60 |
# a minimal example |
| 61 |
writeLines(c("# hello markdown", "```{r hello-random, echo=TRUE}", "rnorm(5)", "```"), |
| 62 |
"test.Rmd") |
| 63 |
knit2html("test.Rmd") |
| 64 |
if (interactive()) browseURL("test.html") |
| 65 |
|
| 66 |
unlink(c("test.Rmd", "test.html", "test.md")) |
| 67 |
} |
| 68 |
\seealso{ |
| 69 |
\code{\link{knit}}, \code{markdown::\link[markdown]{mark_html}} |
| 70 |
} |