Struct std::MdNode
struct MdNode {
int kind;
int level;
int ordered;
int start;
int tight;
int align;
int header;
struct String text;
struct String info;
struct String id;
struct String title;
struct Vec<&heap MdNode> children;
}Fields
MD_HEADING: 1-6
MD_LIST: 1 = ordered, 0 = bullet
MD_LIST (ordered): the first item's number
MD_LIST: 1 if no blank lines separate items/blocks (no <p> in items)
MD_TABLE_CELL: MD_ALIGN_*
MD_TABLE_ROW / MD_TABLE_CELL: part of the header row
MD_TEXT/MD_CODE_SPAN/MD_CODE_BLOCK/MD_HTML_*: content; MD_LINK/MD_IMAGE: URL
MD_CODE_BLOCK: info string ("c", "bash"); MD_CONTAINER: kind
MD_HEADING: id (heading_ids option), else empty
MD_LINK/MD_IMAGE: title attribute
block children, or inline children
Methods
Parses 'text' with every extension off (MdOptions::commonmark()) into a heap-allocated MD_DOC root node (release it with doc.free()).
Parses 'text' with the given extensions.
Renders this node (usually the MD_DOC root) to an HTML fragment. Text is HTML-escaped; only raw HTML nodes (html option) pass through. Headings carry their id, code blocks class="language-<info word>", containers render as <div class="custom-block KIND"> with a <p class="custom-block-title"> (the title, or KIND upper-cased), and 'details' containers as <details class="custom-block details"> with a <summary>.
Renders this node back to Markdown text (a round-trip — not byte-identical to arbitrary input: 'x' and 'x' both come back as 'x', every list marker as '-' or 'N.').
Appends the node's text content — every MD_TEXT/MD_CODE_SPAN/code block below it, without markup — to 'out' (for outlines, search indexes, slugs). Hard and soft breaks become spaces.
Recursively frees this node's whole subtree and the node itself (every MdNode is heap-allocated by MdNode::parse) — don't use it after.
= drop()