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.
This commit is contained in:
1 parent
e1ba630068
commit
3d1c37d217
1 file changed
+4
@@ -16,6 +16,10 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct MdNode {
|
pub struct MdNode {
|
||||||
/// Structural kind and its small attribute set.
|
/// 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,
|
pub kind: MdKind,
|
||||||
/// Byte span in the original source (UTF-8, half open).
|
/// Byte span in the original source (UTF-8, half open).
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|||||||
Reference in new issue
Block a user