pandoc_convert {pandoc}R Documentation

Run Pandoc to convert a document or a text

Description

Main usage of Pandoc is to convert some text from a format into another. This function will do just that:

Usage

pandoc_convert(
  file = NULL,
  text = NULL,
  from = "markdown",
  to,
  output = NULL,
  standalone = FALSE,
  args = c(),
  version = "default"
)

Arguments

file, text

One or the other should be provided

from

Format to convert from. This must be one of the format supported by Pandoc. Default will be markdown. This correspond to the --from/-f CLI flag

to

Format to convert to. This must be one of the format supported by Pandoc. This correspond to the --to/-t CLI flag.

output

Pass a path to a file to write the result from Pandoc conversion into a file. This corresponds to the --output/-o flag

standalone

Should appropriate header and footer be included ? This corresponds to --standalone/-s CLI flag

args

Any other flag supported by Pandoc CLI. See https://pandoc.org/MANUAL.html#options

version

Version to use. Default will be the "default" version. Other possible value are

  • A version number e.g "2.14.1"

  • The nightly version called "nightly"

  • The latest installed version with "latest"

  • Pandoc binary shipped with RStudio IDE with "rstudio"

  • Pandoc binary found in PATH with "system"

Value

output is provided, the absolute file path. If not, the output of pandoc binary run.

Examples


pandoc::pandoc_convert(text = "_This will be emphasize_", to = "latex")


pandoc::pandoc_convert(text = "**This will be bold**", to = "html", version = "2.11.4")


[Package pandoc version 0.2.0 Index]