SW-PAR-001: Goldmark-based markdown parser
#
- Package
- parser
- Priority
- Critical
- Status
- approved
The parser package shall use goldmark to walk the Markdown AST, extracting requirement ID from headings and YAML attributes from fenced ```attr ``` blocks. The first heading+attr pair encountered determines the requirement level (reqLevel); headings at reqLevel with an adjacent attr block are top-level requirements, and headings at reqLevel+1 with an adjacent attr block are sub-requirements (ParentID set to the active parent). Non-attr headings are body text. The parser SHALL also extract YAML frontmatter from .md files, with first-file-wins merge semantics across files in the same document directory. Parsing shall run in parallel across files via a worker pool sized to runtime.NumCPU().
Dynamic reqLevel discovery decouples requirement detection from hardcoded heading levels. The isNextAttrBlock() lookahead provides a universal gate. First-file-wins merge avoids metadata conflicts. Parallel worker pools maximize throughput on multi-document repositories.