Expand description
AST node definitions.
Node taxonomy (heading / paragraph / list / html / emphasis / …), sibling order and spans follow CommonMark’s grammar; a printer’s dispatch is written per this unit.
Beyond that the shapes deliberately diverge from mdast:
- No cooked values: consumers slice the original source through
Spans. Inline node spans are original-source offsets, never rebuilt-buffer ones. - Style facts a printer would otherwise re-derive by peeking at the source (markers, fence chars, reference kinds, break kinds, …) are first-class fields.
- Formatter policy (sentence splitting, CJK classification, alignment judgment) stays out; the AST records lexical facts only.
Blank lines are not stored on nodes: ParserReturn::blanks lists them once,
and sibling spans locate the ones between two blocks (List::tight is computed from it).
Structs§
- Autolink
<https://example.com>/<user@example.com>.- Autolink
Literal - GFM autolink literal (
www.example.com, barehttps://…/ email). - Blockquote
- Code
Block - Code
Span - Container
Directive - A container directive:
- Definition
- A link reference definition:
[label]: dest "title". - Destination
- A link/image destination, excluding the title.
- Emphasis
- Footnote
Definition - Footnote
Reference - GFM
[^label]. - Hard
Break - Heading
- Html
Block - A raw HTML block. Contents are never parsed or formatted.
- Html
Inline - A raw inline HTML tag or comment. The tag is a verbatim token; text around it is markdown.
- Image
and the reference forms.- Link
[text](dest "title")or[text][label]/[text][]/[text].- Liquid
- A
{% … %}/{{ … }}template tag, block-level or inline. Never interpreted: the whole construct, delimiters included, is kept verbatim. - List
- List
Item - Math
Block $$ … $$display math, content is kept raw. As with code fences, the fence length is not stored (printers normalize to$$; the$run atspan.startgives it if ever needed).- Math
Span $ … $inline math. The whole construct,$sequences included, is kept raw; content is never trimmed or decoded.- MdxEsm
- An MDX
import/exportstatement. The parser only establishes the boundary (via the host’s JS parser callback); the content stays raw for embedded formatting. - MdxExpression
- An MDX
{expr}. Boundary only; the expression stays raw. - MdxJsx
Flow - An MDX JSX element at flow level. Tags stay raw for embedded formatting; children are markdown blocks.
- MdxJsx
Text - An MDX JSX element in text. Children are inline markdown.
- Paragraph
- Root
- The document.
- Soft
Break - Strikethrough
- GFM
~~x~~(~x~too withgfm_strikethrough_single_tilde). - Strong
- Table
- Table
Cell - Table
Row - Task
Checkbox [ ],[x]or[X](the raw span keeps the case).- Text
- Thematic
Break - Wiki
Link [[target]], alias-less. Always single-line; the target isspan + 2 .. span - 2, kept raw.
Enums§
- Block
- Flow (block-level) content.
- Code
Block Kind - Hard
Break Kind - Heading
Kind - Inline
- Phrasing (inline) content.
- Link
Kind - Titles and labels are logical-line pieces for the same reason as on
Definition. - List
Marker - Reference
Kind - Reference-link form.
Only
Fullis reformatted; the others are printed verbatim. - Table
Align