Signature
DValue markdown_to_ast(String src) DValue markdown_to_ast(String src, DValue options)
Parameters
DValue document ASTParses Markdown source into a structured DValue document tree.
The parser targets a practical GitHub-flavored subset by default:
ATX headings with
#setext headings
paragraphs
blockquotes
ordered and unordered lists
task list items
fenced code blocks
tables
horizontal rules
emphasis, strong, and strikethrough
links, images, autolinks, and code spans
:::directive blocks for component-based extensions
The returned AST uses type plus node-specific fields such as level, text, lang, href, src, name, argument, attrs, and children.
Top-level documents use:
Common block nodes:
headingparagraphblockquotelistlist_itemcode_blocktabledirectivehr
Common inline nodes:
textcodestrongemstrikelinkimageraw_html
Example:
Options:
options["gfm"]enables GitHub-style extras such as tables, task lists, strikethrough, and bare-URL autolinks. Defaults totrue.options["allow_html"]allows raw HTML passthrough nodes to be captured and rendered. Defaults tofalse.options["components"]provides the component hook map later used bymarkdown_to_html(). The parser preserves directive data needed by those hooks.
Example
DValue ast = markdown_to_ast("# Title");
print(ast.is_array() ? "ast\n" : "empty\n");
ast