01-05-2021



If you need to convert files from one markup format into another, pandoc is your swiss-army knife. Pandoc can convert between the following formats:

At GitHub, we’re building the text editor we’ve always wanted: hackable to the core, but approachable on the first day without ever touching a config file. We can’t wait to see what you build with it. Pandoc - pandoc is an implementation of markdown (and much more) in Haskell.It can convert markdown-formatted text to HTML, LaTeX, rich text format, reStructuredText, or an S5 HTML slide show.

(← = conversion from; → = conversion to; ↔︎ = conversion from and to)

Lightweight markup formats

↔︎ Markdown (including CommonMark and GitHub-flavored Markdown)
↔︎ reStructuredText
→ AsciiDoc
↔︎ Emacs Org-Mode
↔︎ Emacs Muse
↔︎ Textile
← txt2tags

HTML formats

↔︎ (X)HTML 4
↔︎ HTML5

Ebooks

↔︎ EPUB version 2 or 3
↔︎ FictionBook2

Pandoc Html
Documentation formats

→ GNU TexInfo
↔︎ Haddock markup

Roff formats

↔︎ roff man
→ roff ms

TeX formats

↔︎ LaTeX
→ ConTeXt

XML formats

↔︎ DocBook version 4 or 5
↔︎ JATS
→ TEI Simple

Outline formats

↔︎ OPML

Bibliography formats

↔︎ BibTeX
↔︎ BibLaTeX
↔︎ CSL JSON
↔︎ CSL YAML

Word processor formats

Pandoc Html Latex

↔︎ Microsoft Word docx
↔︎ OpenOffice/LibreOffice ODT
→ OpenDocument XML
→ Microsoft PowerPoint

Interactive notebook formats

↔︎ Jupyter notebook (ipynb)

Page layout formats

→ InDesign ICML

Wiki markup formats

Pandoc Html Div

↔︎ MediaWiki markup
↔︎ DokuWiki markup
← TikiWiki markup
← TWiki markup
← Vimwiki markup
→ XWiki markup
→ ZimWiki markup
↔︎ Jira wiki markup

Slide show formats

→ LaTeX Beamer
→ Slidy
→ reveal.js
→ Slideous
→ S5
→ DZSlides

Data formats
Pdf

← CSV tables

Pandoc Html
Custom formats
Html

→ custom writers can be written in lua.

PDF

→ via pdflatex, lualatex, xelatex, latexmk, tectonic, wkhtmltopdf, weasyprint, prince, context, or pdfroff.

Pandoc understands a number of useful markdown syntax extensions, including document metadata (title, author, date); footnotes; tables; definition lists; superscript and subscript; strikeout; enhanced ordered lists (start number and numbering style are significant); running example lists; delimited code blocks with syntax highlighting; smart quotes, dashes, and ellipses; markdown inside HTML blocks; and inline LaTeX. If strict markdown compatibility is desired, all of these extensions can be turned off.

LaTeX math (and even macros) can be used in markdown documents. Several different methods of rendering math in HTML are provided, including MathJax and translation to MathML. LaTeX math is converted (as needed by the output format) to unicode, native Word equation objects, MathML, or roff eqn.

Html

Pandoc includes a powerful system for automatic citations and bibliographies. This means that you can write a citation like

and pandoc will convert it into a properly formatted citation using any of hundreds of CSL styles (including footnote styles, numerical styles, and author-date styles), and add a properly formatted bibliography at the end of the document. The bibliographic data may be in BibTeX, BibLaTeX, CSL JSON, or CSL YAML format. Citations work in every output format.

Pandoc Manual Pdf

There are many ways to customize pandoc to fit your needs, including a template system and a powerful system for writing filters.

Pandoc includes a Haskell library and a standalone command-line program. The library includes separate modules for each input and output format, so adding a new input or output format just requires adding a new module.

Pandoc is free software, released under the GPL. Copyright 2006–2020 John MacFarlane.

17.3 Custom Pandoc templates

An R Markdown is first compiled to Markdown through knitr, and then converted to an output document (e.g., PDF, HTML, or Word) by Pandoc through a Pandoc template. While the default Pandoc templates used by R Markdown are designed to be flexible by allowing parameters to be specified in the YAML, users may wish to provide their own template for more control over the output format.

You can make use of additional YAML fields from the source document when designing a Pandoc template. For example, you may wish to have a department field to be added to your title page, or include an editor field to be displayed below the author. We can add additional variables to the Pandoc template by surrounding the variable in dollar signs ($) within the template. Most variables take values from the YAML metadata of the R Markdown document (or command-line arguments passed to Pandoc). We may also use conditional statements and for-loops. Readers are recommended to check the Pandoc manual for more details: https://pandoc.org/MANUAL.html#using-variables-in-templates. Below is an example of a very minimal Pandoc template for HTML documents that only contains two variables ($title$ and $body$):

Pandoc Html Css

For R Markdown to use the customized template, you can specify the template option in the output format (provided that the output format supports this option), e.g.,

If you wish to design your own template, we recommend starting from the default Pandoc templates included within the rmarkdown package (https://github.com/rstudio/rmarkdown/tree/master/inst/rmd) or Pandoc’s built-in templates (https://github.com/jgm/pandoc-templates).