Basic conversion
pandoc <file> -o <out>
Convert, formats from extensions
pandoc -f <fmt> -t <fmt> <file>
Choose input and output format
pandoc -s <file> -o <out>.html
Standalone page with head and body
pandoc <a>.md <b>.md -o <out>
Concatenate several inputs
cat <file> | pandoc -f <fmt> -t
<fmt>
Read stdin, write stdout
pandoc -o <out>.pdf <file>.md
Make a PDF
Needs a PDF engine such as pdflatex, xelatex, typst or
weasyprint on PATH
pandoc --pdf-engine=<prog> ...
Pick the PDF engine
pandoc --pdf-engine-opt=<opt> ...
Pass an option to the PDF engine
pandoc -t plain <file>
Plain text output
pandoc -f markdown -t gfm <file>
Normalise to GitHub Markdown
pandoc <file>.docx -t markdown --wrap=none
Docx to readable Markdown
pandoc --extract-media=<dir> <file>.docx -o
<out>.md
Pull embedded images out
pandoc --embed-resources -s <file> -o
<out>.html
Single self-contained HTML file
pandoc -d <defaults>.yaml
Load options from a defaults file
pandoc --wrap=none|auto|preserve
Control line wrapping
pandoc --columns=<n>
Line width for wrapping
pandoc --shift-heading-level-by=<n>
Move all headings up or down
pandoc --file-scope ...
Parse each input file on its own
Standalone, templates and styling
pandoc -s ...
Add header and footer
pandoc --toc --toc-depth=<n>
Table of contents to depth n
pandoc -N
Number section headings
pandoc -V <key>=<val>
Set a template variable
pandoc -M <key>=<val>
Set a metadata field
pandoc --metadata-file=<f>.yaml
Metadata from a YAML file
pandoc --template=<f>
Use a custom template
pandoc -D <fmt>
Print the default template
pandoc --css=<url>
Link a stylesheet in HTML
pandoc -H <f> / -B <f> / -A <f>
Include in head / before / after body
pandoc --reference-doc=<f>.docx
Style docx, odt or pptx from a file
Get a starting file with: pandoc -o custom.docx
--print-default-data-file reference.docx
pandoc --syntax-highlighting=<style>
Code highlight style, or none
Since 3.8; replaces the deprecated --highlight-style
pandoc --list-highlight-styles
Available highlight styles
-V geometry:margin=2cm
LaTeX page margins
-V fontsize=12pt
LaTeX base font size
-V mainfont=<name>
Main font with xelatex or lualatex
-V papersize=a4
LaTeX paper size
-V colorlinks=true
Coloured links in LaTeX PDFs
--resource-path=<dirs>
Where to look for images and includes
Filters and slides
pandoc --lua-filter=<f>.lua
Run a Lua filter
pandoc -F <program>
Run a JSON filter program
pandoc -t revealjs -s <f>.md -o
<out>.html
reveal.js slides
pandoc -t beamer <f>.md -o <out>.pdf
Beamer slides as PDF
pandoc <f>.md -o <out>.pptx
PowerPoint slides
--slide-level=<n>
Heading level that starts a slide
--- (horizontal rule)
Start a new slide
::: notes ... :::
Speaker notes
pandoc --sandbox ...
Block file and network access
Does not protect against filters or PDF engines you run
pandoc --verbose / --fail-if-warnings
Debug and strict runs
pandoc --version
Show version and data directory