The official parser and toolchain for RDX (Reactive Document eXpressions) — a strictly typed, declarative document format built on CommonMark.
RDX documents are pure data. No import, no code execution, no JavaScript runtime. Parse .rdx files into a typed AST from Rust, Node.js, Python, or the browser.
Rust
cargo add rdx-parserNode.js (native)
npm install @rdx-lang/nodePython
pip install rdx-parserBrowser / Deno / Edge
npm install @rdx-lang/wasmCLI
cargo install rdx-cliuse rdx_parser::parse;
let root = parse("# Hello\n\n<Notice type=\"warning\">\n Be careful.\n</Notice>\n");
println!("{:#?}", root);import rdx
ast = rdx.parse("# Hello\n\n<Notice type=\"warning\">\n Be careful.\n</Notice>\n")
print(ast["children"][0]["type"]) # headingimport { parse } from "@rdx-lang/node";
const ast = parse(
'# Hello\n\n<Notice type="warning">\n Be careful.\n</Notice>\n',
);
console.log(ast.children[0].type); // heading| Crate | Description |
|---|---|
rdx-ast |
AST type definitions with serde serialization |
rdx-parser |
Parses .rdx documents into a spec-compliant AST |
rdx-schema |
Schema validation for components — required props, types, enum values |
rdx-transform |
Composable AST transform pipeline (auto-slug, table of contents) |
rdx-github |
Optional transform — converts #123, @user, and commit SHAs to links |
rdx-wasm |
WebAssembly bindings for browsers, Deno, and edge runtimes |
rdx-node |
Native Node.js bindings via napi-rs |
rdx-py |
Python bindings via PyO3 — pip install rdx-parser |
rdx-cli |
CLI — parse, validate, convert MDX→RDX, format |
- Frontmatter — YAML metadata between
---delimiters - Components —
<Notice type="warning">with five attribute types (string, primitive, JSON, variable, boolean shorthand) - Context variables —
{$frontmatter.title}interpolation in text and attributes - GFM extensions — tables, strikethrough, task lists, footnotes
- Math — inline
$x^2$and display$$..$$LaTeX - Escaping —
\{$,\{{,\}},\{,\\ - Code blocks — fenced code with language tags (variables are not interpolated inside code)
- HTML pass-through — lowercase tags handled per CommonMark rules
All constructs produce dedicated AST node types — no stringly-typed fallbacks.
Define what components your project allows and validate at build time:
use rdx_schema::{Schema, ComponentSchema, PropSchema, PropType, validate};
use rdx_parser::parse;
let schema = Schema::new()
.strict(true)
.component("Notice", ComponentSchema::new()
.prop("type", PropSchema::enum_required(vec!["info", "warning", "error"]))
);
let root = parse("<Notice type=\"info\">\nContent.\n</Notice>\n");
let diagnostics = validate(&root, &schema);
assert!(diagnostics.is_empty());use rdx_transform::{Pipeline, AutoSlug, TableOfContents};
let root = Pipeline::new()
.add(AutoSlug::new())
.add(TableOfContents { min_depth: 2, max_depth: 3, auto_insert: true })
.run("## Setup\n\n## Usage\n");rdx parse document.rdx --pretty # Output AST as JSON
rdx validate document.rdx --schema s.json # Validate against schema
rdx convert page.mdx --in-place # Convert MDX → RDXPrebuilt binaries available on GitHub Releases.
cargo build
cargo testRequires Rust 2024 edition (1.85+).
| Repo | Description |
|---|---|
rdx |
Parser, schema, transforms, and language bindings (this repo) |
rdx-js |
TypeScript types, JS transform pipeline, and JS-native extensions |
tree-sitter-rdx |
Syntax highlighting for Neovim, Helix, Zed |
The full language specification is in SPECIFICATION.md.
Licensed under either of Apache License, Version 2.0 or MIT License at your option.