DOKK Library

Pandoc Cheat Sheet

Authors Seth Kenlon

License CC-BY-SA-4.0

Plaintext
                      Pandoc Cheat Sheet                                             BY SETH KENLON




   Pandoc is the “Swiss Army Knife” of document conversion. Using it, you can convert files
   from one document format to nearly any other format. This cheat sheet covers some of
   the most common cases.

Text conversion


pandoc --from rst --to markdown --output FILE.md FILE.rst                   reStructuredText to Markdown

pandoc --from markdown --output FILE.docx FILE.md                           Markdown to .docx

pandoc --output FILE.epub FILE1.md FILE2.md                                 Multiple files to Epub



Epub options


--epub-chapter-level 2                             Create chapters at each level-2 header (default is 1)

--toc                                              Generate table of contents

--data-dir ~/my-pandoc-data                        Location of data files (epub.css, templates, and so on)

--epub-cover-image mycover.jpg                     Set cover image

--epub-embed-font myfont.otf                       Embed font

                                                   File containing XML metadata. For example:


--epub-metadata my.xml                             <dc:rights>Creative Commons</dc:rights>
                                                   <dc:creator>Seth Kenlon</dc:creator>
                                                   <dc:title>Panodc Cheatsheet</dc:title>

--epub-stylesheet my.css                           Multiple files to Epub



PDF options


                                                   Set PDF converter to pdflatex (requires LaTeX). Other
--pdf-engine pdflatex                              engines include: weasyprint, xelatex, lualatex, pdfroff,
                                                   ConTeXt, wkhtmltopdf, and prince

-M title:"My PDF"                                  Set PDF title to "My PDF" in PDF metadata




 opensource.com                 Mastodon fosstodon.org/@osdc                               CC BY-SA 4.0
 Pandoc Cheat Sheet                                                              BY SETH KENLON



General options


eval $(pandoc --bash-completion)              Add to your ~/.bashrc file to enable Bash completion

--list-input-formats                          See valid formats for --from option

--list-output-formats                         See valid formats for --to option

--include-in-header myheader.txt              Include header.txt in each page header

--reference-links                             Convert all links to footnotes (do not place inline)

--number-sections                             Number each section heading



Code formatting


--list-highlight-languages                    See available languages for code syntax highlighting

--list-highlight-styles                       See available styles of code syntax highlighting

--strip-comments                              Remove HTML comments from Markdown or Textile

--no-highlight                                Do not highlight code syntax

--print-highlight-style mystyle.theme         Dump highlighting data to create a custom theme

--highlight-style mystyle.theme               Use custom theme for syntax highlighting



Common format notation


  asciidoc          epub      json                 muse                           s5
  beamer            epub2     latex                native                         slideous
  commonmark        epub3     man                  odt                            slidy
  context           fb2       markdown             opendocument                   t2t
  creole            gfm       markdown_github      opml                           tei
  docbook           haddock   markdown_mmd         org                            texinfo
  docbook4          html      markdown_phpext      plain                          textile
  docbook5          html4     ra                   pptx                           tikiwiki
  docx              html5     markdown_strict      revealjs                       twiki
  dokuwiki          icml      mediawiki            rst                            vimwiki
  dzslides          jats      ms                   rtf                            zimwiki


 opensource.com               Mastodon fosstodon.org/@osdc                             CC BY-SA 4.0