pandoc(1)
Pandoc converts documents between different markup and word processing formats.
Synopsis
pandoc [OPTIONS] [INPUT_FILE...]Description
Pandoc is a universal document converter that reads from one format and writes to another. It supports a wide range of input and output formats including Markdown, HTML, LaTeX, Word, PDF, EPUB, and many others. Pandoc is commonly used for converting between markup languages, generating documentation, and batch-processing documents.
The command reads from input files (or stdin if none specified) and writes to stdout by default. You can specify the input and output formats explicitly, though Pandoc will attempt to infer them from file extensions.
Common options
| Flag | What it does |
|---|---|
-f FORMAT, --from=FORMAT | Specify input format (e.g., markdown, html, latex, docx, pdf) |
-t FORMAT, --to=FORMAT | Specify output format (e.g., html, pdf, docx, epub, markdown) |
-o FILE, --output=FILE | Write output to FILE instead of stdout |
-s, --standalone | Produce a standalone document with headers and footers |
--template=FILE | Use FILE as template for generating output |
-V KEY=VAL, --variable=KEY:VAL | Set template variable KEY to VAL |
--css=URL | Link to CSS stylesheet in HTML output |
--toc, --table-of-contents | Include table of contents in output |
-N, --number-sections | Number section headings in output |
--highlight-style=STYLE | Specify syntax highlighting style (e.g., pygments, kate, monochrome) |
-M KEY=VAL, --metadata=KEY:VAL | Set metadata field KEY to VAL |
--verbose | Print diagnostic information to stderr |
Examples
Convert Markdown file to HTML
pandoc README.md -o README.htmlConvert Markdown to PDF with explicit format specification
pandoc document.md -t pdf -o document.pdfConvert HTML to Markdown, piping output to a file
pandoc -f html -t markdown website.html > converted.mdGenerate standalone HTML with table of contents from Markdown
pandoc article.md -s --toc -o article.htmlConvert Markdown to Beamer presentation PDF
pandoc presentation.md -t beamer -o slides.pdfConvert Word document to Markdown
pandoc -f docx document.docx -t markdown -o document.mdCombine multiple Markdown files into EPUB with numbered sections
pandoc chapter*.md --toc -N -o book.epubGenerate HTML with custom CSS and language metadata
pandoc notes.md -s --css=style.css -V lang=en -o notes.html