I write books in plain Markdown. The same source produces a print-ready PDF and an ebook from a single command. This post explains how the pipeline works, and why plain text holds up well for long documents.
The shape of the pipeline
The source is a set of Markdown files under version control. A Makefile drives the build. Pandoc reads the Markdown and produces two outputs along two paths. For print, Pandoc generates LaTeX, and XeLaTeX renders the PDF. For the ebook, Pandoc writes EPUB directly.
One command builds both:
make all
The result is a PDF sized for print and an EPUB that reflows on a reader.
Two books, different inputs
I have run two books through this setup. Their content has little in common.
The first is The BEAM Book, a technical book about the Erlang runtime. It is full of code blocks, figures, cross-references, and tables. The hard parts there are syntax highlighting, consistent figure placement, and references that resolve in both formats.
The second is a techno-thriller novel. It is prose from start to finish. The hard parts there are typography: correct quotation marks, clean chapter openings, and even spacing across hundreds of pages.
The toolchain stays the same. The configuration changes. A code-heavy manual and a novel ask different things from the same tools, and Markdown carries both without fuss.
Where PDF and EPUB diverge
The two formats want different things, and this is where most of the care goes.
A PDF has fixed pages. You control margins, headers, page breaks, and where figures land. XeLaTeX gives fine control and good fonts. The cost is that the layout is yours to manage.
An EPUB reflows. The reader chooses font size and screen width, so a fixed page layout has no meaning. You design for flow instead. Images, footnotes, and tables each need a plan that survives resizing.
Holding both outputs from one source means deciding, for each feature, what it should become in a fixed page and in a reflowable file.
Why plain text holds up
Markdown keeps the source readable and diffable. Version control shows what changed between drafts, line by line. The build is reproducible: same input, same output, no manual steps in a word processor. A VERSION file tracks releases, so every PDF and EPUB maps back to a known revision.
This matters most over time. A book is a long project. Plain text and a scripted build keep the next change safe and boring, which is what you want when you are deep in edits.
A confession belongs here: much of this pipeline got built instead of chapters, and I knew it at the time. Tool building is a very thorough way of not writing.
A note on the second book
The novel above is The Chain, a techno-thriller out 9 September under the pen name Frank Able. The first chapter is free at readthechain.com, and the Kindle edition is on Amazon for pre-order.
If you are weighing a similar setup for your own writing, start small. Put one chapter in Markdown, wire up Pandoc and XeLaTeX, and build a PDF and an EPUB from it. Once the loop works for a chapter, it scales to a book.