How to extract each chapter of a markdown book into its own file
- Step 1Drop your single-file book — Upload the one
book.md(or.mdx/.markdown) that contains the whole manuscript. The splitter takes one file and returns many. It is Pro-only — Free blocks the run withmd-splitter requires a Pro subscription. - Step 2Match the split level to your chapter markers — Set Split at heading level to the level your chapters use.
# ChaptermeansH1;## Chapterunder# Partdividers meansH2. Remember thatH2also breaks on your#part dividers, producing a thin part-divider file between chapters. - Step 3Confirm headings are ATX-style — Only
#,##,###headings at line start are detected. Setext underline headings (Titleover====) are invisible to the splitter. If your book uses underline headings, convert them first or the whole book stays as one file. - Step 4Run the extraction — Run the tool. It slices the body at each chapter heading, builds an in-memory
.mdper chapter, and zips them. If the chosen level has no matching headings, it stops withNo H{level} headings found to split on. - Step 5Download and unzip into your repo — Download
<book>-chapters.zipand extract it into achapters/folder. TheNN-prefixes give you reading-order filenames ready forpandoc chapters/*.md -o book.pdf. - Step 6Re-link and re-add front matter — Check the first file for your metadata block, then convert any same-book anchor links to relative file links. Re-add any copyright/epigraph text that lived above the first chapter heading — it is not in the ZIP.
Choosing the split level for common book structures
Match the dropdown to how your chapters are marked. A heading shallower than your level also ends a chapter, so part dividers become their own (often thin) files.
| Book structure | Chapter marker | Set split level to | What you get |
|---|---|---|---|
| Flat chapter book | # Chapter N | H1 | One file per chapter; sub-sections stay inside |
| Parts containing chapters | ## Chapter under # Part | H2 | One file per chapter plus a thin file per # Part divider |
| Reference manual with sub-sections | ### Topic | H3 | Finest granularity; every #/##/### starts a file |
| Single-level guide | # Section | H1 | One file per section |
Filename and content behaviour (fixed)
There is no filename-pattern control; the scheme below is built into the tool.
| Aspect | Rule | Pandoc-relevant note |
|---|---|---|
| Filename | NN-slug.md, zero-padded index from 00 | Glob *.md returns reading order |
| Slug source | Chapter heading text, GitHub slug algorithm | ## A & B becomes 01-a-b.md |
| Frontmatter | Prepended to first chapter only | Use a separate metadata.yaml for Pandoc instead |
| Pre-first-heading text | Dropped | Move copyright/epigraph under a heading to keep it |
| Code-fence headings | Ignored | Code samples with # stay intact |
| ZIP name | <input>-chapters.zip | book.md -> book-chapters.zip |
Tier limits (Markdown family)
The splitter is Pro-only. The character limit is enforced independently of the byte-size limit.
| Tier | Max file size | Max characters | md-splitter |
|---|---|---|---|
| Free | 1 MB | 500,000 | Blocked (Pro required) |
| Pro | 10 MB | 5,000,000 | Available |
| Pro-media | 50 MB | 20,000,000 | Available |
| Developer | 500 MB | Unlimited | Available |
Cookbook
Real book structures and the exact ZIP contents they produce. All processing happens in your browser.
Flat chapter book on H1
A non-fiction book where each chapter is a # heading. Split on H1 for one file per chapter.
Input book.md: # Introduction ... # The First Principle ... # The Second Principle ... Split level: H1 Output book-chapters.zip: 00-introduction.md 01-the-first-principle.md 02-the-second-principle.md
Parts-and-chapters book on H2
Chapters are ## headings nested under # parts. Splitting on H2 separates chapters and also emits a thin file for each part divider.
Input book.md: # Part I: Foundations ## What Is a System ... ## Feedback Loops ... # Part II: Practice ## Designing for Change ... Split level: H2 Output: 00-part-i-foundations.md (the part divider + intro text) 01-what-is-a-system.md 02-feedback-loops.md 03-part-ii-practice.md 04-designing-for-change.md
Metadata block kept in chapter 00
A Pandoc book with a YAML metadata block. It is carried into the first chapter only — so for a clean Pandoc build, prefer a separate metadata file.
Input book.md: --- title: Systems Thinking author: A. Author lang: en --- # Introduction ... # Chapter One ... Split level: H1 Output: 00-introduction.md -> begins with the --- metadata block 01-chapter-one.md -> no metadata Better Pandoc setup: pull metadata into metadata.yaml and run pandoc metadata.yaml chapters/*.md -o book.pdf
Copyright page above chapter 1 is lost
Front-of-book text above the first heading is not emitted. Wrap it in a heading to preserve it as its own file.
Input book.md: Copyright 2026 A. Author. All rights reserved. # Chapter One ... Split level: H1 Output: 00-chapter-one.md (copyright line is GONE) Fix: # Copyright Copyright 2026 A. Author. All rights reserved. # Chapter One ... -> now 00-copyright.md and 01-chapter-one.md
Round trip back to one file
After per-chapter editing in Git, recombine for a single-file export using the Markdown Merger.
Workflow: 1. md-splitter: book.md -> chapters/00..NN.md (edit in Git) 2. md-merger: drop chapters/*.md -> merged.md (md-merger joins with --- separators and an optional TOC) 3. Pandoc: pandoc merged.md -o book.epub
Edge cases and what actually happens
Free tier
Pro requiredExtraction is Pro-only. Free users get md-splitter requires a Pro subscription. Upgrade to Pro or higher to produce the ZIP.
Chosen level has no headings
errorPicking H2 for a #-only book yields No H{level} headings found to split on. Lower the split level or correct heading levels — H2 will also catch # headings, but H1 will not catch ##.
Setext underline headings
Not detectedUnderline-style headings (Title over ====/----) are not recognised as split points. Convert them to ATX #-style first, or the entire book stays as a single chapter.
Front matter above the first chapter
Dropped by designCopyright pages, dedications, and epigraphs placed above the first heading are not written to any file. Put each under its own heading (# Dedication) to keep it as a chapter file.
YAML metadata only in chapter 00
ExpectedFrontmatter is prepended to the first chapter only. For Pandoc, this means later chapters lack lang/title. Prefer a standalone metadata file passed alongside chapters/*.md rather than relying on the embedded block.
Duplicate chapter titles
PreservedTwo # Appendix chapters produce 00-appendix.md and 01-appendix.md. The index prefix prevents collisions; nothing is overwritten.
Cross-chapter anchor links
May breakLinks like [see the intro](#introduction) no longer resolve once chapters are separate files. Rewrite them as relative paths (00-introduction.md). The splitter does not adjust links.
Footnotes referenced across chapters
May breakIf a footnote definition lives in a different chapter from its [^1] reference, the split separates them. Keep each footnote definition in the same chapter as its reference, or manage footnotes with Pandoc after the split. See md-footnote-linker for footnote tidying.
Manuscript over the char limit
errorThe file read enforces the tier char limit; a Pro book over 5,000,000 characters is rejected with a message naming the count. Use Pro-media (20M) or Developer (unlimited) for very large books.
Images referenced by relative path
PreservedImage syntax is copied verbatim into the chapter file, so a  link survives. But the path is relative to the original file location — keep your images/ folder alongside the extracted chapters, or rewrite paths with md-image-path-rewriter.
Frequently asked questions
Will this preserve my Pandoc metadata block?
Only in the first chapter. The YAML (---) or TOML (+++) frontmatter is prepended to the first output file and not repeated. For a multi-file Pandoc build, the cleaner approach is to keep metadata in a separate metadata.yaml and pass it alongside chapters/*.md.
What level should I split a parts-and-chapters book on?
Use H2 if chapters are ## headings under # parts. Be aware that splitting on H2 also breaks on the # part dividers, so you get a thin file for each part divider in addition to the chapter files. If you only want chapter files, restructure parts as front-matter or accept the divider files and delete them after extraction.
Do the filenames keep my chapters in order?
Yes. Each filename starts with a two-digit, zero-padded index (00-, 01-, ...) assigned in document order, so a *.md glob returns reading order — which is exactly what Pandoc uses for multi-file input.
What happens to a copyright or epigraph page above chapter one?
It is dropped. The splitter does not start writing until the first heading at your chosen level. Wrap front-of-book text in its own heading (# Copyright, # Epigraph) to make each its own chapter file.
Can I customise the chapter filenames?
No. The pattern is fixed at NN-slug.md where the slug is derived from the heading text. The only control is the split level. Rename the files after extracting the ZIP if you need a different convention.
Does the tool handle headings inside code blocks correctly?
Yes. It tracks fenced code blocks and ignores # lines inside them, so code samples that contain # comments or Markdown-heading examples do not accidentally split a chapter.
What output format do I get?
A ZIP archive of .md files, one per chapter, named <book>-chapters.zip. It is generated in your browser with JSZip — the manuscript is never uploaded.
Will my cross-references between chapters still work?
Same-book anchor links break once chapters are separate files, and footnotes split from their definitions stop resolving. The splitter does not rewrite links. Re-link to relative file paths after extraction, and keep footnote definitions in the same chapter as their references.
How do I rebuild the book into one file?
Use the Markdown Merger. It joins the chapter files with --- separators and can generate a table of contents. From there you can export with Pandoc to PDF/EPUB.
Is there a size limit on the book?
Yes, by tier: Pro 10 MB / 5,000,000 characters, Pro-media 50 MB / 20,000,000, Developer 500 MB / unlimited. The character count is checked separately from byte size, so a long prose book can hit the char limit before the MB limit.
Can I split several books at once?
No — it processes one file at a time. To go the other direction and combine many files into one, use the Markdown Merger.
What about images and figures in my chapters?
Image links are copied into the chapter files unchanged. The paths stay relative to the original file's location, so keep your image folder next to the extracted chapters, or batch-rewrite the paths with md-image-path-rewriter.
Privacy first
All Markdown processing runs locally in your browser using JavaScript. No file is ever uploaded to JAD Apps servers — only metadata counters are saved for signed-in dashboard stats.