Understand the Markdown AST node hierarchy
masterThe Markdown AST is organized into hierarchical content types that restrict which nodes can be nested within others. Understanding these relationships is critical for writing valid AST transformations:
- Root: The top-level node containing
FlowContent. - FlowContent: Block-level elements such as
Blockquote,Code,Heading,HTML,List,Image,ImageReference,ThematicBreak,Table,Math, orContent(which includesDefinitionandParagraph). - PhrasingContent: Inline elements that can appear within text, such as
Link,LinkReference, orStaticPhrasingContent. - StaticPhrasingContent: A subset of phrasing content that does not allow further nesting, including
Image,Break,Emphasis,HTML,ImageReference,InlineCode,Strong,Text,Delete, andInlineMath. - Table Structure: A
TablecontainsTableContent(TableRow), which containsRowContent(TableCell), which containsPhrasingContent.