Split markdown files by headings for easier sharing with AI assistants
npm install splitdownSplit large Markdown files into manageable chunks based on headings. Useful for feeding docs into AI assistants with context window limits.
- Split by heading level (h1-h6)
- Auto-numbered files to preserve order
- Sanitized, human-readable filenames
- Configurable output directory and filename prefixes
``bash`
npm install
npm run build
`bash`
npx splitdown
Split by H2 headings (default):
`bash`
npx splitdown README.md
Split by H1 headings to a specific directory:
`bash`
npx splitdown docs.md --level 1 --output ./chapters
| Option | Alias | Default | Description |
| ----------- | ----- | ---------------- | ------------------------------- |
| --output | -o | ./split-output | Output directory |--level
| | -l | 2 | Heading level to split on (1-6) |--prefix
| | -p | section- | Filename prefix |--preview
| | | | Preview only, no files written |--index
| | | | Generate INDEX.md with links |
`bash``
npm install
npm run dev # watch mode
npm run build # production build
MIT