Split Markdown by Heading
Splits a long Markdown document at every ## heading and puts a suggested file name, such as “<!-- part 2: install.md -->”, before each part — for breaking content up for a wiki or documentation site.
- File, image, and document tools run in the browser, but originals may still contain personal or sensitive information. Review both source files and outputs before sharing or submitting them.
Splits a long Markdown document at every ## heading and puts a suggested file name, such as “<!-- part 2: install.md -->”, before each part — for breaking content up for a wiki or documenta…
Example Split Markdown by Heading result <!-- part 1: guide.md --> # Guide Intro --- <!-- part 2: install.md --> ## Install Steps --- <!-- part 3: usage.md --> ## Usage Examples Next step: Check the heading structure first with the Markdown TOC generator to see in advance where the splits will fall.
How to use Split Markdown by Heading
A long single-file document often has to be split into one page per chapter for a documentation site or wiki. This splitter divides Markdown at every ## heading (H2) and shows each part with a suggested file name, such as “<!-- part 2: install.md -->”.
The suggested name is the part’s first heading in anchor form (lowercase with hyphens). Content before the first ## heading (the # title and preamble) becomes the first part on its own, and ### subheadings stay inside the ## part above them. A horizontal rule (---) separates the parts.
The result appears as one continuous text, so copy each part and save it under the suggested name.
- Choose the document under .md/.txt file, or paste a long document into Markdown content.
- Press Run to see the parts split at each ## heading with suggested file-name comments.
- Copy each part and save it as a file with the name given in its comment.
Useful for
- Splitting a long README into pages for a documentation site
- Separating a single-file manual into chapter files
- Dividing content to post section by section on a wiki
- Handing out translation work section by section
Limits and checks
- To connect the split files again, add previous and next links at the bottom of each one so readers can move between them.
- Check the heading structure first with the Markdown TOC generator to see in advance where the splits will fall.
Worked example
Example input: A guide in three parts
# Guide Intro ## Install Steps ## Usage Examples
Headings in other scripts keep their letters in the suggested name, the same way anchors do.
Result
<!-- part 1: guide.md --> # Guide Intro --- <!-- part 2: install.md --> ## Install Steps --- <!-- part 3: usage.md --> ## Usage Examples
Headings in other scripts keep their letters in the suggested name, the same way anchors do.
Common issues
Everything comes out as a single part.
There are no ## headings, or no space between ## and the text (##Install), so there’s nothing to split on. Fix the “## Heading” format with the Markdown formatter first.
It doesn’t split at ### subheadings.
Only ## headings (H2) split the document. ### and lower stay in the ## part above, and # lines inside code blocks aren’t treated as headings.
How to interpret the result
Splits a long Markdown document at every ## heading and puts a suggested file name, such as “<!-- part 2: install.md -->”, before each part — for breaking content up for a wiki or documentation site.
Related workflow
Check the heading structure first with the Markdown TOC generator to see in advance where the splits will fall.
Privacy and review notes
ToolBada runs this tool in your browser where it can. Use sample values instead of personal or confidential data, and review the result before relying on it.
FAQ
Does it save the parts as separate files?
All parts appear in one result. Copy each part and save it yourself under the suggested name.
What if the same heading appears twice?
The suggested names may be the same too, so add a number to one when saving.
Where does the preamble go?
Text before the first ## heading (the # title and preamble) becomes the first part, and its suggested name comes from the # heading.