Write in Markdown. Publish everywhere. Book4matter (Book Formatter) takes in Markdown, or plain text, and formats it for distribution. It uses this one source to produce output in HTML, EPUB, PDF and print versions. (PDF versions have clickable links, print has page references).
It was built to take a manuscript to Amazon KDP without worrying about formatting while you are writing.
Book4matter is available as a web app, a prebuilt docker container and as source.
The web version is at app.book4matter.com.
Source for web version: Book4matter-web GitHub.
You can get a docker container for Book4matter with
docker pull book4matter/book4matter
Or just pull the source, and install it locally. Source for command line version: Book4matter GitHub
Full User Manual is available here: examples/docs/book4matter.html
This webpage is rendered by Book4matter. It was written in Markdown.
TBH, Book4matter is not really designed to be a website builder. But using it to build its own website seemed reasonable.
Book4matter lets you keep your text, and the formatting separate:
Point ten books at one style file and restyle them all from a single edit. The manuscript never changes.
Every output is generated from the same Markdown, so they never fall out of sync.
A ready-to-print PDF.
I’ve used this for Amazon KDP, so it follows the rules there, like “no hyperlinks”.
External hyperlinks are reformatted to show the URL after the anchor text.
Book4matter (https://www.book4matter.com)
Internal links are converted to page number references
Book4matter on page 37
A table of contents is automatically generated. This PDF does not include a cover, since that is a separate upload on KDP.
A reflowable e-book that passes the W3C EPUBCheck validator (the same class of checks KDP runs on upload), so most rejections are caught before you ever upload.
Note: Each EPUB publisher has different requirements. They restrict things like manuscript length, image size, and even limits on references to other publishers. You’ll want to check these out, before publishing.
One self-contained HTML page with an automatic table of contents and your own stylesheet
This is how this website was generated.
These three books are built by this same pipeline on every commit, in all four forms. Everything below came from Markdown — no hand-editing of the output.
The Book4matter User Manual explains how to write, configure, and build your books. It is also a working example of the tool documenting itself.
The Pocket Pipeline — a short worked example that exercises the features.
The Smallest Fire — An example to show the pipeline on plain text input. (AI generated)
The quickest way to run Book4matter is the prebuilt Docker image: nothing to clone, and nothing to install but Docker itself — no pandoc, no Typst, no fonts to hunt down. (Prefer to install the tools directly, or build the image yourself? The manual covers all three ways.)
https://docs.docker.com/engine/install/
Pull the image from Docker Hub:
docker pull book4matter/book4matter
You can see the entry for book4matter on docker hub.
A book is just a directory:
my-book/
book_metadata.yaml # title, author, rights
book_style.yaml # trim, margins, fonts
chapters/
010-first.md
020-second.md
Chapters are combined in filename order, so a numeric prefix controls the sequence.
Mount the folder that holds your book at /work and name the form you want. Everything after the image name is an ordinary bf command:
docker run --rm -v "$PWD":/work book4matter/book4matter print my-book/ # KDP print interior PDF
docker run --rm -v "$PWD":/work book4matter/book4matter pdf my-book/ # shareable PDF with live links
docker run --rm -v "$PWD":/work book4matter/book4matter epub my-book/ # validated EPUB
docker run --rm -v "$PWD":/work book4matter/book4matter html my-book/ # single-page website
Each command writes into my-book/out/; the tool only ever writes there, never back over your manuscript.
Powered by Typst under the hood: proper hyphenation and justification, small title/copyright/contents front matter, running heads, and quality book faces (Libertinus Serif for text, a Helvetica-metric sans for headings) bundled right in the image — no font wrangling. You can use your own fonts, too, of course.
Trim sizes, gutter margins that scale with page count, and an EPUB that clears the same validator KDP uses. The defaults aim at a US 6×9 trade paperback that uploads clean.
Standard Pandoc Markdown: headings, emphasis, lists, block quotes, footnotes, tables, images, and hyperlinks. Plain .txt works too, for novelists who want nothing but words and scene breaks.
Treat top-level headings as parts (or sections) with chapters beneath, or flip a switch and let them be numbered chapters in a novel with no visible headings at all.
Already have a .docx? Book4matter can import it, split it into chapter files on its headings, and pull the embedded images out for you — a running start instead of a blank page.
You can run everything from a pinned Docker image. No host installs, no network at build time, and the same inputs produce the same outputs on any machine.
If you want more control, you can install locally, or you can build the docker image locally, and run that way.
Book4matter is a thin pipeline over two excellent tools, wired together so you never have to touch either directly.
Because the styling lives outside your prose, the same manuscript flows into every format without edits, and one change to a style file re-themes every book that points at it.
The full manual — installation, configuration, every command, and the design decisions behind the defaults — is itself a Book4matter book. Read it online, build it from the docs/ directory, or read the source in the repository.
Book4matter is a command-line tool, and open source. If you’re comfortable in a terminal and want your words to look like a real book, it’s built for you.
Book4matter is open source. We want you to use us, if we are the right choice for you. If another tool works better for you, that’s fine with us. Here are some of the popular alternatives, and why you might to use them vs. book4matter.
Many of the alternatives have a broader ranges of predesigned styles for books. Book4matter give you a lot of control, but only one default style.
Paid tools frequently come with customer support.
Some have local applications you can run, which can give a nicer interface than a web app.
Vellum is a commercial Mac application supporting editing and formatting. It’s very easy to use, and has great support and a lot of premade styles. It also makes specific ebooks for each of the major publishing platforms, like Amazon, Apple, Google, Kobo, etc., which all have slightly different requirements.
While you can import, they really expect you will import once, and issues come up when you want to keep working with your preferred editor.
Atticus is a web app, like book4matter. It combines editing and formatting across Windows, Mac, Linux, and Chromebook. It offers manuscript import, ebook and print output, ready-made templates, a custom theme builder, and customer support.
Draft2Digital converts uploaded manuscripts into EPUB and print-ready PDF, with free downloads even if you don’t distribute through the service. It is useful for authors who want straightforward conversion and optional retailer distribution without adopting a writing editor. The tradeoffs are reliance on an online service and less direct layout control than a customizable typesetting pipeline. Distribution is a separate consideration: commissions and account fees apply under its publishing terms.
Reedsy Studio combines browser-based writing, editing, collaboration, and formatting, with manuscript import and EPUB and print-ready PDF exports. Its core writing and formatting features are free, making it an accessible option for authors who want a shared workspace. The tradeoffs are reliance on a hosted application, formatting within its provided design options, and paid plans for some additional writing and planning features.
Book4matter is just a coordination layer for pandoc and typst, with functions for writing books, like indexes, chapters. You could use Pandoc and Typst to do the same. Even if you don’t program, you can have an AI set it up for you. Or just grab the Book4matter source, and make the changes you want.