Learn R Programming

rmarkdown (version 0.1.2)

pandoc_convert: Convert a document with pandoc

Description

Convert documents to and from various formats using the pandoc utility.

Usage

pandoc_convert(input, to, from = NULL, output = NULL, citeproc = FALSE,
  options = NULL, verbose = FALSE)

Arguments

input

Input file (must be UTF-8 encoded)

to

Format to convert to

from

Format to convert from (if not specified then the format is determined based on the file extension of input).

output

Output file (if not specified then determined based on format being converted to)

citeproc

TRUE to run the pandoc-citeproc filter (for processing citations) as part of the conversion

options

Character vector of command line options to pass to pandoc.

verbose

TRUE to show the pandoc command line which was executed

Details

Supported input and output formats are described in the pandoc user guide.

The system path as well as the version of pandoc shipped with RStudio (if running under RStudio) are scanned for pandoc and the highest version available is used.

Examples

Run this code
# NOT RUN {
library(rmarkdown)

# convert markdown to various formats
pandoc_convert("input.md", to = "html")
pandoc_convert("input.md", to = "pdf")

# process citations
pandoc_convert("input.md", to = "html", citeproc = TRUE)

# add some pandoc options
pandoc_convert("input.md", to="pdf, options = c("--listings"))
# }

Run the code above in your browser using DataLab