Adds a pypandoc-based section splitter utility that parses .qmd chapter
files and extracts individual sections for processing. This enables
guaranteed 100% coverage in editorial workflows by processing each
section independently rather than entire chapters at once.
Key features:
- Uses pypandoc JSON AST for robust parsing (correctly ignores headers
inside code blocks, callouts, and TikZ diagrams)
- Falls back to regex-based block tracking if pypandoc unavailable
- Extracts section metadata: title, ID, line numbers, word count
- Supports listing, extraction to files, and JSON manifest output
- Designed for integration with polish workflow agents
Usage:
python3 section_splitter.py -f chapter.qmd --list
python3 section_splitter.py -f chapter.qmd --manifest
python3 section_splitter.py -f chapter.qmd --get-section 3