Introduction to Pandoc
Welcome to Pandoc — a universal document converter. Learn how Pandoc empowers your creation.
Pandoc is an open-source document conversion tool written in Haskell, developed by Professor John MacFarlane. It supports conversion between dozens of document formats, including Markdown, HTML, LaTeX, Word, PDF, EPUB, and more, earning it the nickname “the Swiss Army knife of document conversion.”
Pandoc Getting Started Guide
What is Pandoc?
Pandoc is a powerful document conversion tool capable of transforming one markup format into another. For example, you can convert a Markdown file into a PDF, Word document, or HTML webpage with just a single command.
Installing Pandoc
Windows
Download the installer from the official website: https://pandoc.org/installing.html
macOS
Install using Homebrew:
brew install pandoc
Linux (Ubuntu/Debian)
sudo apt install pandoc
Basic Usage
Suppose you have an example.md file and want to convert it to PDF:
pandoc example.md -o example.pdf
Common conversion examples:
- To Word:
pandoc input.md -o output.docx - To HTML:
pandoc input.md -o output.html - To LaTeX:
pandoc input.md -o output.tex
Common Options
-s: Generate a standalone document (includes HTML header, etc.)--toc: Generate a table of contents-V: Set variables (e.g.,-V geometry:margin=1into set PDF margins)
A Complete Example
# Convert Markdown to PDF with a table of contents
pandoc report.md -s --toc -o report.pdf
# Convert to HTML with custom styling
pandoc article.md -s -c style.css -o article.html
Advanced Features
Pandoc supports advanced features like YAML metadata blocks, citations, math formulas (LaTeX syntax), tables, and syntax highlighting. You can perform deep customization using templates and filters.
Learning Resources
- Official Documentation: https://pandoc.org
- GitHub Repository: https://github.com/jgm/pandoc
- Try Online: https://pandoc.org/try
Note: The Markdown content above can be saved directly as a .md file and converted into various formats using Pandoc.