Parse Markdown body bytes into a flat Vec<kebab_parse_types::ParsedBlock> with heading paths and line ranges preserved, ready for kebab-normalize to lift into CanonicalDocument.
Why now / why this size
This is the heaviest part of P1 parser. Separating it from frontmatter and from normalization keeps each piece tractable. Determinism of line ranges directly determines citation quality (design §0 Q3 / §3.4 SourceSpan::Line).
ParsedBlock is defined in kebab-parse-types (design §3.7b). kebab-parse-md does NOT define its own; it consumes the shared type. Lift to kebab_core::Block (with BlockId assignment) is kebab-normalize's job (p1-4).
Behavior contract
Source-map: each ParsedBlock carries SourceSpan::Line { start, end } relative to the original file (i.e., add body_offset_lines).
Heading tree: every block records its ancestor heading texts in order (e.g., ["아키텍처", "Chunking 정책"]).
Tables: GFM tables produce ParsedPayload::Table { headers, rows }; if a table cell is malformed, fall back to ParsedPayload::Paragraph + Warning::MalformedTable.
Image references:  produces ParsedPayload::ImageRef { src, alt }. AssetId resolution happens later in kebab-normalize (when image src can be matched to a workspace asset).
Lists: ordered/unordered preserved via ParsedPayload::List { ordered, items }; nested list items flattened so each items[i] is a Vec<kebab_core::Inline> for one top-level item.
Inline elements: only Text, Code, Link, Strong, Emph (per kebab_core::Inline per design §3.4). Drop other inlines silently.
Malformed input never panics. Worst case: empty Vec<ParsedBlock> + Warning::ExtractFailed.
Storage / wire effects
None.
Test plan
kind
description
fixture / data
unit
heading tree depth + heading_path correctness
inline
unit
code block lang tag preserved
inline
unit
GFM table parses; malformed table degrades to paragraph + warning
inline
unit
line range correct under various line-ending styles (LF / CRLF)
All tests under cargo test -p kebab-parse-md --lib blocks.
Definition of Done
cargo check -p kebab-parse-md passes
cargo test -p kebab-parse-md blocks passes
Snapshot tests stable across two runs
No imports outside Allowed dependencies
PR links design §3.4
Out of scope
Frontmatter (p1-2).
Lifting kebab_parse_types::ParsedBlock → kebab_core::Block with BlockId (p1-4 normalize).
Chunking (p1-5).
Risks / notes
pulldown-cmark source-map may not include exact byte ranges for all event kinds; line ranges are the binding contract per design (line-range citation is the primary form for Markdown).
CRLF normalization: convert internally to LF for span math but report line numbers from the original byte stream.