Convert documents between formats using pandoc. Supports HTML, Markdown, DOCX, PDF, EPUB, LaTeX, ODT, RST, Org, MediaWiki, JIRA, CSV, Jupyter notebooks, and many more — any direction pandoc supports. Use this skill whenever the user wants to convert, transform, or export a document from one format to another, even if they don't mention pandoc explicitly. Triggers include: "convert this to PDF", "make a Word doc from this markdown", "export as EPUB", "turn this HTML into a PDF", "transform", "generate PDF", "render to", or any request involving document format conversion. Also use when the user wants to apply custom styling, add a table of contents, use a template, or set metadata during conversion.
Convert documents between any formats pandoc supports, with full control over styling, templates, table of contents, metadata, and PDF engine selection.
pandoc input.html -o output.pdf --pdf-engine=weasyprint -s
If the HTML uses external CSS, include it:
pandoc input.html -o output.pdf --pdf-engine=weasyprint -s --css=style.css
pandoc input.md -o output.pdf --pdf-engine=xelatex -s --toc --toc-depth=3
pandoc input.md -o output.docx -s
To use a reference (template) document for styling:
pandoc input.md -o output.docx --reference-doc=template.docx
pandoc input.md -o output.html -s --css=style.css --toc
pandoc input.docx -o output.md --extract-media=./media
pandoc input.md -o output.epub -s --toc --epub-cover-image=cover.jpg
pandoc input.tex -o output.pdf --pdf-engine=xelatex
pandoc input.csv -o output.html -s
Add --toc and optionally --toc-depth=N (default 3):
pandoc input.md -o output.pdf --pdf-engine=xelatex -s --toc --toc-depth=2
Set title, author, date via YAML frontmatter in the source file or via -M:
pandoc input.md -o output.pdf --pdf-engine=xelatex -s \
-M title="My Report" -M author="Jane Doe" -M date="2026-03-15"
Pandoc supports filters that transform the AST. Lua filters are self-contained:
pandoc input.md -o output.pdf --lua-filter=my-filter.lua
Pandoc concatenates multiple inputs:
pandoc chapter1.md chapter2.md chapter3.md -o book.pdf --pdf-engine=xelatex -s --toc
pandoc input.docx -o output.md --extract-media=./media
| Problem | Likely cause | Fix |
|---|---|---|
| PDF has missing characters | Font doesn't support the glyphs | Use --pdf-engine=xelatex with -V mainfont="DejaVu Serif" |
| PDF conversion fails | No compatible PDF engine installed | Check which xelatex lualatex tectonic pdflatex weasyprint wkhtmltopdf prince and install one that matches your output needs |
| DOCX looks unstyled | No reference doc | Create a styled DOCX template and pass --reference-doc |
| HTML images missing | Relative paths broken | Use --self-contained to embed images as base64 |
| CSS has no effect on PDF | LaTeX PDF engine selected | Use --pdf-engine=weasyprint, --pdf-engine=wkhtmltopdf, or --pdf-engine=prince |
| Table of contents empty | No headings in source | Ensure source uses # headings (Markdown) or <h1>–<h6> (HTML) |
For a full list of supported input and output formats, see references/formats.md.