Skip to content

A CLI to split large Markdown files into manageable chunks based on headings.

License

Notifications You must be signed in to change notification settings

iamkaf/splitdown

Splitdown

CI License NPM Version

Split large Markdown files into manageable chunks based on headings. Useful for feeding docs into AI assistants with context window limits.

Features

  • Split by heading level (h1-h6)
  • Auto-numbered files to preserve order
  • Sanitized, human-readable filenames
  • Configurable output directory and filename prefixes

Installation

npm install
npm run build

Usage

npx splitdown <input-file> [options]

Examples

Split by H2 headings (default):

npx splitdown README.md

Split by H1 headings to a specific directory:

npx splitdown docs.md --level 1 --output ./chapters

Options

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

Development

npm install
npm run dev   # watch mode
npm run build # production build

License

MIT

About

A CLI to split large Markdown files into manageable chunks based on headings.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks