Skip to main content

Pandoc cheat sheet


Cheat sheet for Pandoc, the versatile free-software document converter, to convert files from one markup format into another. Pandoc is widely used for publishing workflows.

Introduction #

Pandoc is a versatile document conversion tool that allows you to convert files between various markup formats. Here are some of the most common Pandoc commands:

Basic Conversions #

Markdown to Word #

Converts to output.docx Word document:

pandoc -o output.docx

Markdown to PDF #

Convert to output.pdf:

pandoc -o output.pdf


Convert input.html to output.pdf:

pandoc input.html -o output.pdf

Markdown to EPUB #

Convert to output.epub ebook format:

pandoc -o output.epub

Working with Multiple Files #

Concatination #

Combines (concatinates) multiple input files, e.g. file1.txt and file2.txt, into a single output.pdf file:

pandoc file1.txt file2.txt -o output.pdf

Custom styling #

Specifying Output Template #

Applies a custom, e.g. LaTeX template, to PDF output:

pandoc -o output.pdf --template=mytemplate.tex

Custom CSS Styles #

Applies custom CSS styles from mystyles.css to the HTML output:

pandoc -o output.html --css=mystyles.css

Syntax Highlighting #

Enables syntax highlighting using Pygments for HTML output:

pandoc -o output.html --syntax-highlight=pygments

Custom elements #

Including table of contents #

To add a table of contents to the output PDF (requires, e.g. to make use of heading levels).

pandoc -o output.pdf --toc

Setting Metadata #

Set custom document metadata, such as title:

pandoc -o output.pdf --metadata title="My Document"

Numbered Sections #

Numbers the sections in the output document:

pandoc -o output.pdf --number-sections

Usage format #

Converting to Slides #

Converts ‘’ to a output.pdf Beamer presentation in PDF format:

pandoc -t beamer -o output.pdf

These are just a few examples, and Pandoc supports many more options and formats. You can refer to the official documentation for a comprehensive list of commands and options.

Further readings #

Sources and recommended, further resources on the topic:


Jonas Jared Jacek • J15k

Jonas Jared Jacek (J15k)

Jonas works as project manager, web designer, and web developer since 2001. On top of that, he is a Linux system administrator with a broad interest in things related to programming, architecture, and design. See:


License: Pandoc cheat sheet by Jonas Jared Jacek is licensed under CC BY-SA 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:

<p xmlns:cc="" xmlns:dct=""><a property="dct:title" rel="cc:attributionURL" href="">Pandoc cheat sheet</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="">Jonas Jared Jacek</a> is licensed under <a href="" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>

For more information see the DITig legal page.

“Good design comes from a deep understanding of the technologies behind the scenes.”

Jeffrey Veen, American designer and design strategistThe Art & Science of Web Design, - IT quotes