EVOLUTION-MANAGER
Edit File: pandoc.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: A Pandoc wrapper to convert documents to other formats</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for pandoc {knitr}"><tr><td>pandoc {knitr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>A Pandoc wrapper to convert documents to other formats</h2> <h3>Description</h3> <p>This function calls Pandoc to convert documents to other formats such as HTML, LaTeX/PDF and Word, etc, (optionally) based on a configuration file or in-file configurations which specify the options to use for Pandoc. </p> <h3>Usage</h3> <pre> pandoc(input, format, config = getOption("config.pandoc"), ext = NA) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>input</code></td> <td> <p>A character vector of Markdown filenames (must be encoded in UTF-8).</p> </td></tr> <tr valign="top"><td><code>format</code></td> <td> <p>Name of the output format (see References). This can be a character vector of multiple formats; by default, it is obtained from the <code>t</code> field in the configuration. If the configuration is empty or the <code>t</code> field is not found, the default output format will be <code>'html'</code>.</p> </td></tr> <tr valign="top"><td><code>config</code></td> <td> <p>Path to the Pandoc configuration file. If missing, it is assumed to be a file with the same base name as the <code>input</code> file and an extension <code>.pandoc</code> (e.g. for ‘<span class="file">foo.md</span>’ it looks for ‘<span class="file">foo.pandoc</span>’)</p> </td></tr> <tr valign="top"><td><code>ext</code></td> <td> <p>Filename extensions. By default, the extension is inferred from the <code>format</code>, e.g. <code>latex</code> creates <code>pdf</code>, <code>dzslides</code> creates <code>html</code>, and so on</p> </td></tr> </table> <h3>Details</h3> <p>There are two ways to input the Pandoc configurations – through a config file, or embed the configurations in the input file as special comments between <code style="white-space: pre;"><!--pandoc</code> and <code style="white-space: pre;">--></code>. </p> <p>The configuration file is a DCF file (see <code><a href="../../base/html/dcf.html">read.dcf</a></code>). This file must contain a field named <code>t</code> which means the output format. The configurations are written in the form of <code>tag:value</code> and passed to Pandoc (if no value is needed, just leave it empty, e.g. the option <code>standalone</code> or <code>s</code> for short). If there are multiple output formats, write each format and relevant configurations in a block, and separate blocks with blank lines. </p> <p>If there are multiple records of the <code>t</code> field in the configuration, the input markdown file will be converted to all these formats by default, unless the <code>format</code> argument is specified as one single format. </p> <h3>Value</h3> <p>The output filename(s) (or an error if the conversion failed). </p> <h3>References</h3> <p>Pandoc: <a href="https://pandoc.org">https://pandoc.org</a>; Examples and rules of the configurations: <a href="https://yihui.org/knitr/demo/pandoc/">https://yihui.org/knitr/demo/pandoc/</a> </p> <p>Also see R Markdown (v2) at <a href="http://rmarkdown.rstudio.com">http://rmarkdown.rstudio.com</a>. The <span class="pkg">rmarkdown</span> package has several convenience functions and templates that make it very easy to use Pandoc. The RStudio IDE also has comprehensive support for it, so I'd recommend users who are not familiar with command-line tools to use the <span class="pkg">rmarkdown</span> package instead. </p> <h3>See Also</h3> <p><code><a href="../../base/html/dcf.html">read.dcf</a></code> </p> <h3>Examples</h3> <pre> system("pandoc -h") # see possible output formats </pre> <hr /><div style="text-align: center;">[Package <em>knitr</em> version 1.29 <a href="00Index.html">Index</a>]</div> </body></html>