rdx-parser
Reference parser for RDX documents. Converts .rdx source text into a spec-compliant AST.
Usage
use parse;
let root = parse;
for child in &root.children
What it parses
- Frontmatter — YAML metadata between
---delimiters - CommonMark — headings, paragraphs, lists, blockquotes, thematic breaks, links, images
- GFM extensions — tables, strikethrough, task lists, footnotes
- Components —
<Notice type="warning">with five attribute types - Variables —
{$frontmatter.title}interpolation in text and attributes - Math — inline
$x^2$and display$$..$$LaTeX - Escaping —
\{$,\{{,\}},\{,\\ - HTML pass-through — lowercase tags handled per CommonMark rules
Error handling
The parser never panics on malformed input. Instead, it emits ErrorNode entries in the AST for:
- Unclosed component tags
- Misnested tags (
<A><B></A></B>) - Malformed JSON attributes
- Invalid variable paths
This allows host environments to render error boundaries without crashing the entire document.
Entry point
One function. String in, AST out. No configuration, no plugins, no runtime.
Dependencies
rdx-ast— AST type definitionspulldown-cmark— CommonMark parsing with GFM extensionsserde_json— JSON attribute parsingserde-saphyr— YAML frontmatter parsing
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.