How to write a book in Markdown and build a Word manuscript
Write a book in Markdown with one file per chapter, then use Pandoc to build a Word manuscript with your own styles, or an EPUB, from the same files.

To write a book in Markdown, keep each chapter in its own numbered .md file inside one project folder, put the title and author in a small metadata file, and join the chapters with Pandoc when someone needs a manuscript: pandoc ch*.md -o book.docx produces a single Word document, and a reference document gives it your fonts and spacing. The same files become an EPUB with one more command. You write in plain text and hand each reader the format they ask for, which for editors and publishers is usually Word.
Pandoc details below are from the Pandoc manual (checked November 2026), and every command was tested with Pandoc 3.9. For how Markdown fits other kinds of writing, see Markdown for writers.
Why write a book in Markdown?
Markdown keeps the manuscript as plain text that any editor opens, so you can write on any device, compare drafts line by line, and reorganize chapters by moving files. Formatting choices (fonts, margins, spacing) wait until you build the manuscript.
What that gives you in practice:
- Small files. A chapter is one file you can open, move or back up on its own.
- Real history. In a Git repository, every change to every chapter is recorded and you can compare any two drafts.
- No layout fights while drafting. Headings, emphasis, scene breaks and footnotes are a few characters each.
The trade-off comes later. Once an editor returns the manuscript with tracked changes in Word, you have two copies of the book, and you need to decide which one is the master. That step is covered at the end.
How should you set up the folders and files?
One folder for the book, one file per chapter, and numbers at the start of each file name so the chapters sort in reading order. Put everything else (notes, images, styles) in clearly named places beside them.
my-book/
metadata.yaml
ch00-front-matter.md
ch01-the-arrival.md
ch02-the-letter.md
ch03-the-storm.md
ch99-acknowledgments.md
reference.docx
images/
notes/
characters.md
timeline.md
Rules that save trouble later:
- Pad the numbers. Use
ch01,ch02, notch1,ch2. Shells and file lists sort names as text, soch10would land beforech2. - One top-level heading per chapter file. Start each chapter with
# Chapter title. Pandoc and Word use those headings to mark chapters. - Mark scene breaks the same way everywhere. A line with
* * *is a Markdown horizontal rule and converts to one in Word. - Keep research out of the chapter pattern. Files in
notes/don't matchch*.md, so they never end up in the manuscript. - Use relative paths for images, such as
.
What goes in the front matter?
Two different things share the name. Book front matter is the title page, copyright line and dedication, which you can write in ch00-front-matter.md. Pandoc front matter is metadata such as the title and author, which belongs in a separate file.
A minimal metadata.yaml:
title: The Long Way Home
author: Jane Writer
Pass it with --metadata-file=metadata.yaml. In a Word build, Pandoc places the title and author at the top using the Title and Author paragraph styles. For an EPUB, the manual's EPUB Metadata section lists further fields, including identifier (for an ISBN), publisher, rights and cover-image. Keeping metadata in one file is simpler than adding a block to the top of every chapter.
How do you build a Word manuscript with Pandoc?
Run Pandoc from the book folder with all chapter files as input and a .docx file as output. The manual says that when several input files are given, "pandoc will concatenate them all (with blank lines between them) before parsing," so the chapters join in the order the shell lists them.
The basic build:
pandoc ch*.md -o book.docx
With metadata and your own styles:
pandoc ch*.md --metadata-file=metadata.yaml --reference-doc=reference.docx -o book.docx
Add --toc if you want a table of contents at the start. Pandoc writes it as an instruction for Word to build the contents, and you may need to right-click it and choose Update Field after opening the file.
How do you control fonts, spacing and page breaks?
Use a reference document. According to the manual, Pandoc ignores its contents but uses its "stylesheets and document properties (including margins, page size, header, and footer)" in the new file.
-
Create a starting copy of Pandoc's default:
pandoc -o reference.docx --print-default-data-file reference.docx -
Open
reference.docxin Word or LibreOffice and change the styles, not the text:- Normal and Body Text: font, size, line spacing.
- First Paragraph: the paragraph after a heading. Many manuscripts indent body paragraphs but not the first one, and these two styles let you do that.
- Heading 1: turn on Page break before (in Word's Paragraph settings, under Line and Page Breaks) so every chapter starts on a new page.
- Title and Author: the title page lines.
-
Set margins and page size, then save.
-
Build with
--reference-doc=reference.docx.
The manual suggests changing only the styles in this file and leaving everything else alone.
Do editors and publishers accept Markdown?
Expect to send a Word file. Agents, editors and small presses commonly ask for .docx, and submission guidelines spell out fonts, spacing and file format. Read the guidelines of each place you submit to and put their requirements into your reference document.
If you self-publish, check the platform's list. Amazon's Kindle Direct Publishing help lists Microsoft Word (DOC/DOCX) and EPUB among the accepted eBook manuscript formats (checked November 2026). Markdown files go to people who use Markdown; everyone else gets the build.
How do you make an EPUB?
Change the output file name to .epub and add a cover. Pandoc builds the ebook from the same chapter files and metadata.
pandoc ch*.md --metadata-file=metadata.yaml --epub-cover-image=cover.jpg -o book.epub
From the manual:
- By default, the EPUB is split "into chapters at level-1 headings," which matches the one-
#-per-file rule above.--split-levelchanges that. - For the cover image, "it is recommended that the image be less than 1000px in width and height."
Open the result in an ebook reader before you share it. If it is going to Kindle, KDP's help page recommends checking EPUB files with Kindle Previewer.
How do you handle edits that come back in Word?
Decide which copy is the master before you send the manuscript out. Two workable approaches:
- Markdown stays the master. Read the editor's tracked changes in Word and make the accepted edits in your chapter files. Slower, but your plain text history stays complete.
- Word becomes the master. After copyediting, keep working in the .docx. Most late-stage work (copyedits, proofs, typesetting queries) happens in Word anyway.
To pull an edited manuscript back into Markdown, Pandoc can read .docx. Its --track-changes option decides what happens to Word's changes: accept (the default) applies them, reject ignores them, and both drop comments. Expect to split the result back into chapter files by hand.
How do you track progress while writing?
Count words per chapter from the terminal:
wc -w ch*.md
It prints a count for each file and a total. Markdown marks are counted as words, so treat the number as close rather than exact. In a Git repository, a commit at the end of each writing session gives you a dated record of the draft.
Writing a book in Noteline
Noteline, which we make, opens the book folder in its desktop app, renders footnote references as you type, and jumps between headings in a long chapter with the Table of Contents panel (Cmd+Shift+O on a Mac, Ctrl+Shift+O on Windows and Linux). It exports the chapter you have open to Word (Cmd+Option+E) or PDF (Cmd+Option+P), Ctrl+Alt on Windows and Linux, with Pandoc and Typst built in, and images linked by a relative path are included. Export works one note at a time, so build the full manuscript with the Pandoc command above; see Word and PDF export.