Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Pandoc.convert

Converts Pandoc to other format


Description

Calling John MacFarlane's great program to convert specified file (see f parameter below) or character vector see text paramater to other formats like HTML, pdf, docx, odt etc.

Usage

Pandoc.convert(f, text, format = "html", open = TRUE, options = "",
  footer = FALSE, proc.time, portable.html = TRUE,
  pandoc.binary = panderOptions("pandoc.binary"))

Arguments

f

Pandoc's markdown format file path. If URL is provided then the generated file's path is tempfile() but please bear in mind that this way only images with absolute path would shown up in the document.

text

Pandoc's markdown format character vector. Treated as the content of f file - so the f parameter is ignored. The generated file's path is tempfile().

format

required output format. For all possible values here check out Pandoc homepage: http://johnmacfarlane.net/pandoc/

open

try to open converted document with operating system's default program

options

optionally passed arguments to Pandoc (instead of pander's default)

footer

add footer to document with meta-information

proc.time

optionally passed number in seconds which would be shown in the generated document's footer

portable.html

instead of using local files, rather linking JS/CSS files to an online CDN for portability and including base64-encoded images if converting to HTML without custom options

pandoc.binary

path to pandoc's binary if not found in the path

Value

Converted file's path.

Note

This function depends on Pandoc which should be pre-installed on user's machine. See the INSTALL file of the package.

References

John MacFarlane (2012): _Pandoc User's Guide_. http://johnmacfarlane.net/pandoc/README.html

Examples

## Not run: 
Pandoc.convert(text = c('# Demo', 'with a paragraph'))
Pandoc.convert('http://rapporter.github.io/pander/minimal.md')
# Note: the generated HTML is not showing images with relative path from the above file.
# Based on that `pdf`, `docx` etc. formats would not work! If you want to convert an
# online markdown file to other formats with this function, please pre-process the file
# to have absolute paths instead.

## End(Not run)

pander

An R 'Pandoc' Writer

v0.6.3
AGPL-3 | file LICENSE
Authors
Gergely Daróczi [aut, cre] (<https://orcid.org/0000-0003-3149-8537>), Roman Tsegelskyi [aut]
Initial release
2018-11-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.