Pandoc: Convert Your Documents

Jul 25 2012

Pandoc is an Open Source tool (and a library) for converting documents from one format to another. Specifically, it can take a document written as Markdown, reStructured Text, Textile, HTML, DocBook, or LaTeX and convert it to any of a plethora of other formats, including:

  • Word DOCX
  • Open Document Text (ODT)
  • HTML, XHTML, or HTML 5
  • PDF
  • LaTeX
  • EPUB ebooks
  • Many others

The Pandoc project provides installers for Windows and Mac. Pandoc already has packages in most (if not all) of the popular Linux distributions.

In addition to its general conversion functionality, Pandoc augments the input formats with support for citations, mathematical notation, and many Markdown extensions. <!--break-->

Example

The Pandoc documentation has dozens of examples, but here's one quick one to illustrate how easy it is to use:

$ pandoc -S example.md -o example.docx

The above converts the example.md Markdown document into a Microsoft Word DOCX document. The -S flag produces "typographically correct" output. That is, it converts double-dashes to en-dashes, quotations to "smart quotes" and three periods to ellipses.