pandoc

CLI

Universal document converter between dozens of formats.

Convert documents between Markdown, HTML, PDF, DOCX, and 40+ formats (PDF output needs LaTeX or a headless browser)

6 of 7 recipes verified by execution · 2026-09-17#convert#markdown#pdf#docx#latex

Verified commands

Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.

Convert Markdown to DOCX

Verified macOS · Linux · 2026-09-17
pandoc input.md -o output.docx

Convert Markdown to standalone HTML

Verified macOS · Linux · 2026-09-17
pandoc input.md -s -o output.html

Convert DOCX to Markdown

Verified macOS · Linux · 2026-09-17
pandoc input.docx -t markdown -o output.md
Common failures (1)
  • Images not extractedAdd --extract-media=./media to save embedded images

Convert HTML to Markdown

Verified macOS · Linux · 2026-09-17
pandoc -f html -t markdown input.html -o output.md

Convert Markdown to PDF without LaTeX (macOS, via Chrome)

macOS only

Verified macOS · 2026-09-17
pandoc input.md -s -o tmp.html && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --no-pdf-header-footer --print-to-pdf=output.pdf "file://$PWD/tmp.html"
Common failures (1)
  • pandoc input.md -o output.pdf fails with 'pdflatex not found'pandoc needs a LaTeX engine for PDF; rendering HTML with headless Chrome avoids installing TeX

Convert Markdown to PDF without LaTeX (Linux, via Chromium)

Linux only

Verified Linux · 2026-09-17
pandoc input.md -s -o tmp.html && chromium --headless=new --no-sandbox --disable-gpu --no-pdf-header-footer --print-to-pdf=output.pdf "file://$PWD/tmp.html"

More recipes

Curated from documentation and usage. Percentages are estimates, not measurements.

Convert Markdown to PDF with LaTeX

~88% est.
pandoc input.md -o output.pdf --pdf-engine=xelatex
Common failures (2)
  • Error: pdflatex/xelatex not foundInstall a LaTeX engine (brew install basictex / apt install texlive-xetex), or use the Chrome route above
  • Korean/CJK characters missingUse --pdf-engine=xelatex with -V mainfont='Noto Sans CJK KR'

Install

Homebrewbrew install pandoc
aptsudo apt install pandoc

Agent notes

When to use
Document format conversion, generating PDFs or Word docs from Markdown
Quick examples
  • pandoc README.md -o output.pdf
  • pandoc doc.docx -t markdown

Use from an agent

curl -s https://clihub.com/api/tools/pandoc | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug pandoc on the MCP server at https://clihub.com/mcp.

Homepage ↗Repository ↗GPL-2.00 views