If you write in Markdown and want a clean EPUB without touching Calibre or Sigil, Pandoc is the tool you didn’t know you needed. It’s a command-line document converter that handles more formats than anything else out there — and it produces surprisingly good ebooks.
What Pandoc does
Pandoc converts documents between formats. Markdown to EPUB. Word to Markdown. HTML to PDF. LaTeX to EPUB. The list is long — Pandoc supports over 40 input and output formats.
For ebook creators, the key conversion is Markdown → EPUB. If you write your drafts in Markdown (as many technical writers and bloggers do), Pandoc gets you from draft to e-reader with one terminal command:
pandoc manuscript.md -o book.epub --toc
That single line creates a valid EPUB with a table of contents. No GUI. No clicking around. Just a file you can sideload to your Kindle or Kobo.
Why use Pandoc over Calibre for conversion
Calibre is a full library manager. Pandoc is a converter. The difference matters:
Pandoc is faster. Converting a 300-page Markdown manuscript takes about 2 seconds. Calibre’s conversion pipeline is heavier because it does more — metadata management, cover embedding, format optimization.
Pandoc is scriptable. You can build automated workflows. Write a chapter in Obsidian, run a shell script, and your EPUB is ready. This is invaluable if you publish regularly or maintain documentation.
Pandoc produces cleaner output. The HTML inside Pandoc-generated EPUBs is minimal and predictable. Calibre’s output is functional but can include wrapper divs and inline styles that make later editing harder.
Getting set up
Install Pandoc from pandoc.org. On macOS:
brew install pandoc
On Linux, use your package manager. On Windows, download the installer.
For EPUB output, Pandoc needs a template. The default template works fine for basic books, but you can customize it — add fonts, adjust margins, and style chapter headings with a custom CSS file:
pandoc manuscript.md -o book.epub --toc --css=style.css
A realistic workflow
Here’s how I use Pandoc in practice:
- Write the manuscript in Markdown, one
.mdfile per chapter - Concatenate all chapters into a single file (or use Pandoc’s multi-file support)
- Run Pandoc to generate the EPUB
- Optionally polish in PageEdit for visual tweaks
Pandoc won’t replace Calibre for library management or Sigil for deep editing. But if your workflow starts in Markdown, Pandoc is the fastest path from draft to e-reader. It’s free, it’s fast, and it works everywhere.