1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/renderMarkdown.R
\name{renderMarkdown}
\alias{renderMarkdown}
\title{Render markdown to an HTML fragment}
\usage{
renderMarkdown(file, output = NULL, text = NULL, renderer = "HTML",
renderer.options = NULL, extensions = getOption("markdown.extensions"),
encoding = "UTF-8")
}
\arguments{
\item{file}{a character string giving the pathname of the file to read from.
If it is omitted from the argument list, then it is presumed that the
\code{text} argument will be used instead.}
\item{output}{a character string giving the pathname of the file to write to.
If it is omitted (\code{NULL}), then it is presumed that the user expects
the results returned as a \code{character} vector.}
\item{text}{a character vector containing the \emph{markdown} text to
transform (each element of this vector is treated as a line in a file).}
\item{renderer}{the name of the renderer that will be used to transform the
\code{file} or \code{text}.}
\item{renderer.options}{options that are passed to the renderer. For
\code{HTML} renderer options see \code{\link{markdownHTMLOptions}}.}
\item{extensions}{options that are passed to the \emph{markdown} engine. See
\code{\link{markdownExtensions}}.}
\item{encoding}{ignored (always assumes the file is encoded in UTF-8).}
}
\value{
\code{renderMarkdown} returns NULL invisibly when output is to a
file, and either \code{character} (with the UTF-8 encoding) or \code{raw}
vector depending on the renderer output type.
}
\description{
\code{renderMarkdown} transforms the \emph{markdown} text provided by the
user in either the \code{file} or \code{text} variable. The transformation is
either written to the \code{output} file or returned to the user. The default
rendering target is "HTML".
}
\details{
\pkg{markdown} uses (and ships with) the popular Sundown library provided by
GitHub. C stubs are available to implement new renderers.
}
\examples{
(renderMarkdown(text = "Hello World!"))
# a few corner cases
(renderMarkdown(text = character(0)))
(renderMarkdown(text = ""))
}
\seealso{
\code{\link{markdownExtensions}}, \code{\link{markdownHTMLOptions}},
\code{\link{markdownToHTML}}.
For a description of the original \emph{markdown} version:
\url{http://daringfireball.net/projects/markdown/}
The original Sundown library on github:
\url{https://github.com/vmg/sundown}
C stubs for writing new renders are in inst/include/markdown_rstubs.[ch].
}
|