From 3d1c37d21729426f49e2eff7413c2cc42ca70e77 Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 20 Nov 2026 10:44:14 +0800 Subject: [PATCH] fix(markdown): flatten AST kind into node JSON objects `inspect --ast` and AST goldens now show `{"kind":"heading","level":2,...}` instead of a nested `{"kind":{"kind":"heading",...}}` object, matching spec/markdown-profile.md section 5 and the shape new contributors expect. --- crates/marqdo-markdown/src/ast.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/marqdo-markdown/src/ast.rs b/crates/marqdo-markdown/src/ast.rs index 1dc12fc..64793d3 100644 --- a/crates/marqdo-markdown/src/ast.rs +++ b/crates/marqdo-markdown/src/ast.rs @@ -16,6 +16,10 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct MdNode { /// Structural kind and its small attribute set. + /// + /// Flattened into the node object so the JSON view is + /// `{"kind":"heading","level":2,...}` rather than a nested object. + #[serde(flatten)] pub kind: MdKind, /// Byte span in the original source (UTF-8, half open). pub span: Span,