Files
kebab/fixtures/markdown/nested-headings.blocks.snapshot.json
altair823 f604a381df p1-3: snapshot tests + clippy fix
Adds two snapshot tests (`nested-headings.md`, `code-and-table.md`) under
crates/kb-parse-md/tests/blocks_snapshots.rs, with matching baseline JSON
next to each fixture. The snapshot view projects `kb_core::Inline` to
flat strings — `Inline` carries `serde(tag = "kind")` which is
incompatible with newtype variants holding a primitive (`Text(String)`),
so direct serialization of `ParsedBlock` would fail today. The view
preserves the contract that matters for P1-3 (heading paths, source
spans, payload kinds, payload text/code/table content) and will keep
working once kb-core fixes the Inline schema in a later task.

Also tightens `level_to_use >= 1 && <= 6` into `(1..=6).contains(&_)` to
satisfy `clippy::manual_range_contains`.
2026-04-30 14:17:41 +00:00

137 lines
2.4 KiB
JSON

{
"blocks": [
{
"kind": "heading",
"heading_path": [],
"source_span": {
"kind": "line",
"start": 1,
"end": 1
},
"payload": {
"kind": "heading",
"level": 1,
"text": "Top"
}
},
{
"kind": "paragraph",
"heading_path": [
"Top"
],
"source_span": {
"kind": "line",
"start": 3,
"end": 3
},
"payload": {
"kind": "paragraph",
"text": "intro",
"inlines_flat": "intro"
}
},
{
"kind": "heading",
"heading_path": [
"Top"
],
"source_span": {
"kind": "line",
"start": 5,
"end": 5
},
"payload": {
"kind": "heading",
"level": 2,
"text": "Section A"
}
},
{
"kind": "paragraph",
"heading_path": [
"Top",
"Section A"
],
"source_span": {
"kind": "line",
"start": 7,
"end": 7
},
"payload": {
"kind": "paragraph",
"text": "body of A",
"inlines_flat": "body of A"
}
},
{
"kind": "heading",
"heading_path": [
"Top",
"Section A"
],
"source_span": {
"kind": "line",
"start": 9,
"end": 9
},
"payload": {
"kind": "heading",
"level": 3,
"text": "Sub A.1"
}
},
{
"kind": "paragraph",
"heading_path": [
"Top",
"Section A",
"Sub A.1"
],
"source_span": {
"kind": "line",
"start": 11,
"end": 11
},
"payload": {
"kind": "paragraph",
"text": "deeper",
"inlines_flat": "deeper"
}
},
{
"kind": "heading",
"heading_path": [
"Top"
],
"source_span": {
"kind": "line",
"start": 13,
"end": 13
},
"payload": {
"kind": "heading",
"level": 2,
"text": "Section B"
}
},
{
"kind": "paragraph",
"heading_path": [
"Top",
"Section B"
],
"source_span": {
"kind": "line",
"start": 15,
"end": 15
},
"payload": {
"kind": "paragraph",
"text": "body of B",
"inlines_flat": "body of B"
}
}
],
"warnings": []
}