Commit Graph

1 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
d8b4361154 feat: add section splitter for section-by-section editorial processing
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
2026-01-04 17:16:08 -05:00