rdx-transform
Composable AST transform pipeline for RDX documents.
Usage
use ;
let root = new
.add
.add
.run;
Or use the convenience function:
use parse_with_defaults;
let root = parse_with_defaults;
Built-in transforms
AutoSlug
Generates URL-safe id attributes on headings for deep-linking.
use AutoSlug;
let slug = new;
// "## Getting Started" → id: "getting-started"
// Duplicate headings get "-1", "-2", etc.
TableOfContents
Generates a nested list of links from document headings.
use TableOfContents;
let toc = TableOfContents ;
If auto_insert is false, the transform replaces a <TableOfContents /> component placeholder instead.
Writing custom transforms
Implement the Transform trait:
use ;
;
Utilities
| Function | Description |
|---|---|
walk(nodes, callback) |
Immutable depth-first traversal |
walk_mut(nodes, callback) |
Mutable depth-first traversal |
collect_text(nodes) |
Extract plain text from a node tree |
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.