As it name suggests, pandoc is the panacea for documents inter-format conversions. It support a variety of markdown formats, and can also be used to convert a markdown document to its input format, to perform cleanup operations.
You might also want to look at PP Generic Preprocessor (with Pandoc in mind), a powerful tool to enhance pandoc workflow via macros.
Pandoc is a cross-platform FOSS command line tool for converting documents from one format to another. It natively supports 22 input- and 41 output-formats, and can be extended to work with custom input (reader) and outupt (writer) formats through external scripts – likes the custom BBCode writers in this project.
Pandoc is written in Haskell, and precompiled binary releases for Windows, Mac OS X and Linux are available for download.
Pandoc was originally created by John MacFarlane, a philosophy professor at the University of California, Berkeley, and is now maintained collaboratively on GitHub.
As of pandoc v1.19.1, the supported Markdow formats are:
markdown
– pandoc’s extended Markdown.markdown_github
– GitHub-Flavored Markdown.markdown_mmd
– MultiMarkdown.markdown_phpextra
– PHP Markdown Extra.markdown_strict
– original unextended Markdown.
As of pandoc v1.19.2.1, there are 59 supported Markdown extensions – here shown preceded by a +
or -
indicating whether it is enabled by default in pandoc’s Markdown:
Ext. Name | Ext. Name | ||
---|---|---|---|
- | abbreviations |
+ | intraword_underscores |
+ | all_symbols_escapable |
+ | latex_macros |
- | angle_brackets_escapable |
+ | line_blocks |
- | ascii_identifiers |
+ | link_attributes |
+ | auto_identifiers |
- | lists_without_preceding_blankline |
- | autolink_bare_uris |
- | literate_haskell |
+ | backtick_code_blocks |
- | markdown_attribute |
+ | blank_before_blockquote |
+ | markdown_in_html_blocks |
+ | blank_before_header |
- | mmd_header_identifiers |
+ | bracketed_spans |
- | mmd_link_attributes |
+ | citations |
- | mmd_title_block |
- | compact_definition_lists |
+ | multiline_tables |
+ | definition_lists |
+ | native_divs |
- | east_asian_line_breaks |
+ | native_spans |
- | emoji |
+ | pandoc_title_block |
- | epub_html_exts |
+ | pipe_tables |
+ | escaped_line_breaks |
+ | raw_html |
+ | example_lists |
+ | raw_tex |
+ | fancy_lists |
+ | shortcut_reference_links |
+ | fenced_code_attributes |
+ | simple_tables |
+ | fenced_code_blocks |
+ | startnum |
+ | footnotes |
+ | strikeout |
+ | grid_tables |
+ | subscript |
- | hard_line_breaks |
+ | superscript |
+ | header_attributes |
+ | table_captions |
- | ignore_line_breaks |
+ | tex_math_dollars |
+ | implicit_figures |
- | tex_math_double_backslash |
+ | implicit_header_references |
- | tex_math_single_backslash |
+ | inline_code_attributes |
+ | yaml_metadata_block |
+ | inline_notes |
You can view a list of all markdown extensions supported in pandoc by typing:
pandoc --list-extensions
As of v1.19.2.1, pandoc supports 22 input- and 41 output-formats:
INPUT | OUTPUT | DESC |
---|---|---|
— | asciidoc |
AsciiDoc |
— | beamer |
beamer slide shows |
commonmark |
commonmark |
CommonMark Markdown. |
— | context |
ConTeXt |
docbook |
docbook |
DocBook 4 – DocBook 4 Guide. |
ibid. | docbook5 |
DocBook 5. |
docx |
docx |
Word docx. |
— | dokuwiki |
DokuWiki markup |
— | dzslides |
DZSlides |
epub |
epub |
EPUB v2 book. |
ibid. | epub3 |
EPUB v3 book. |
— | fb2 |
FictionBook2 e-book |
haddock |
haddock |
Haddock markup. |
html |
html |
HTML 4. |
ibid. | html5 |
HTML 5 |
— | icml |
InDesign IDML > ICML |
json |
json |
JSON version of native AST. |
latex |
latex |
LaTeX. |
— | man |
groff man pages |
markdown |
markdown |
pandoc’s extended Markdown. |
markdown_github |
markdown_github |
GitHub-Flavored Markdown. |
markdown_mmd |
markdown_mmd |
MultiMarkdown. |
markdown_phpextra |
markdown_phpextra |
PHP Markdown Extra. |
markdown_strict |
markdown_strict |
original unextended Markdown. |
mediawiki |
mediawiki |
MediaWiki markup. |
native |
native |
native Haskell. |
odt |
odt |
ODT (OpenOffice text document). |
— | opendocument |
OpenDocument. |
opml |
opml |
OPML (Outline Processor Markup Language). |
org |
org |
Emacs Org mode. |
— | plain |
plain text |
— | revealjs |
revealjs |
rst |
rst |
reStructuredText. |
— | rtf |
Rich Text Format |
— | s5 |
S5 HTML slide shows |
— | slideous |
Slideous |
— | slidy |
Slidy |
t2t |
— | txt2tags. |
— | tei |
TEI Simple |
— | texinfo |
GNU Texinfo |
textile |
textile |
(subsets of) Textile. |
twiki |
— | TWiki markup. |
— | zimwiki |
ZimWiki markup |
You can view a list of all input formats supported in pandoc by typing:
pandoc --list-input-formats
You can view a list of all output formats supported in pandoc by typing:
pandoc --list-output-formats
There is also the list-pandoc-formats.bat
script for generating text files of pandoc’s supported: input/output formats, markdown extensions, highlight languages and styles.
Instructions on how to setup pandoc.
You have different choices for setting up pandoc:
The advised choice is #2 – install via Chocolatey!
Pandoc for Windows ships with an msi installer.
When asked, choose “install pandoc for current user” (best choice).
Since Pandoc doesn’t (can’t) check for updates, the best method of installation is via Chocolatey (or ChocolateyGUI):
- Pandoc package at Chocolatey.org
Chocolatey handles silent installation and updates in the background (using default options), and helps you keeping pandoc always updated to the latest release.
If you prefer to use pandoc in standalone mode, you’ll need to extract pandoc binary executable from the installer file – for some reasons, the standalone version is no longer available for download. The installer contains two binary files (pandoc.exe
and pandoc-citeproc.exe
), the html User’s Guide and the license files.
- Dowload the pandoc msi installer (eg:
pandoc-1.XX-windows.msi
) - Unpack it (using 7-Zip) and extract and rename the
pandocEXE
file topandoc.exe
- Optionally (if you need to use CiteProc for working with citations and bibliography files) also extract
pandoc_citeprocEXE
and rename it topandoc_citeproc.exe
.
Make sure that pandoc.exe
(and, eventually, pandoc_citeproc.exe
) is reachable via %PATH%
.
Pandoc resources available in this repository.
list-pandoc-formats.bat
– generates txt files listing pandoc’s supported: input/output formats, markdown extensions, highlight languages and styles.
- Pandoc-Goodies — a repo dedicated to pandoc resources.
- GitHub HTML5 Template — a standalone html5 template built with GitHub’s CSS that will provide the GitHubbish look and feel to your converted documents.
- Pandoc Wiki: User contributed templates