Files
kebab/fixtures/markdown/code-and-table.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

64 lines
1.0 KiB
JSON

{
"blocks": [
{
"kind": "heading",
"heading_path": [],
"source_span": {
"kind": "line",
"start": 1,
"end": 1
},
"payload": {
"kind": "heading",
"level": 1,
"text": "Code And Table"
}
},
{
"kind": "code",
"heading_path": [
"Code And Table"
],
"source_span": {
"kind": "line",
"start": 3,
"end": 7
},
"payload": {
"kind": "code",
"lang": "rust",
"code": "fn main() {\n println!(\"hi\");\n}"
}
},
{
"kind": "table",
"heading_path": [
"Code And Table"
],
"source_span": {
"kind": "line",
"start": 9,
"end": 12
},
"payload": {
"kind": "table",
"headers": [
"col a",
"col b"
],
"rows": [
[
"1",
"2"
],
[
"3",
"4"
]
]
}
}
],
"warnings": []
}