| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/pandoc.R |
| 3 |
\name{pandoc_convert} |
| 4 |
\alias{pandoc_convert} |
| 5 |
\title{Convert a document with pandoc} |
| 6 |
\usage{ |
| 7 |
pandoc_convert( |
| 8 |
input, |
| 9 |
to = NULL, |
| 10 |
from = NULL, |
| 11 |
output = NULL, |
| 12 |
citeproc = FALSE, |
| 13 |
options = NULL, |
| 14 |
verbose = FALSE, |
| 15 |
wd = NULL |
| 16 |
) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{input}{Character vector containing paths to input files |
| 20 |
(files must be UTF-8 encoded)} |
| 21 |
|
| 22 |
\item{to}{Format to convert to (if not specified, you must specify |
| 23 |
\code{output})} |
| 24 |
|
| 25 |
\item{from}{Format to convert from (if not specified then the format is |
| 26 |
determined based on the file extension of \code{input}).} |
| 27 |
|
| 28 |
\item{output}{Output file (if not specified then determined based on format |
| 29 |
being converted to).} |
| 30 |
|
| 31 |
\item{citeproc}{\code{TRUE} to run the pandoc-citeproc filter (for processing |
| 32 |
citations) as part of the conversion.} |
| 33 |
|
| 34 |
\item{options}{Character vector of command line options to pass to pandoc.} |
| 35 |
|
| 36 |
\item{verbose}{\code{TRUE} to show the pandoc command line which was executed} |
| 37 |
|
| 38 |
\item{wd}{Working directory in which code will be executed. If not |
| 39 |
supplied, defaults to the common base directory of \code{input}.} |
| 40 |
} |
| 41 |
\description{ |
| 42 |
Convert documents to and from various formats using the pandoc utility. |
| 43 |
} |
| 44 |
\details{ |
| 45 |
Supported input and output formats are described in the |
| 46 |
\href{https://pandoc.org/MANUAL.html}{pandoc user guide}. |
| 47 |
|
| 48 |
The system path as well as the version of pandoc shipped with RStudio (if |
| 49 |
running under RStudio) are scanned for pandoc and the highest version |
| 50 |
available is used. |
| 51 |
} |
| 52 |
\examples{ |
| 53 |
\dontrun{ |
| 54 |
library(rmarkdown) |
| 55 |
|
| 56 |
# convert markdown to various formats |
| 57 |
pandoc_convert("input.md", to = "html") |
| 58 |
pandoc_convert("input.md", to = "latex") |
| 59 |
|
| 60 |
# process citations |
| 61 |
pandoc_convert("input.md", to = "html", citeproc = TRUE) |
| 62 |
|
| 63 |
# add some pandoc options |
| 64 |
pandoc_convert("input.md", to = "latex", options = c("--listings")) |
| 65 |
} |
| 66 |
} |