Expand description
Typed doctree IR with docutils-equivalent node semantics (M2 wave 1).
Design (recorded in docs/superpowers/plans/2026-08-07-m2-wave-map.md):
docutils-mirror generic node — node identity and attributes are data, not
Rust types, so the pseudo-XML parity serializer is a direct dump and
docutils transforms/writers port line-by-line. One Node struct covers
every element type; kind holds the docutils tagname from kinds.
Source spans are structural: every node carries a byte-offset Span
into the original source (docutils itself only keeps (source, line)).
Spans are line-granular in wave 1; the wave-2 inline parser refines them.
Modules§
- ids
- docutils-exact id/name normalization and the document id registry.
- kinds
- docutils element tagnames.
- messages
system_messagenode construction with docutils-exact shape.- pformat
- Pseudo-XML emitter, byte-identical to docutils
document.pformat().
Structs§
- Attrs
- docutils’ universal list attributes (
basic_attributes+backrefs) as typed fields, plus an open, name-sorted list for everything else (refuri,enumtype,level, …).pformatmerges both sets and prints all pairs in one alphabetical sequence, exactly like docutilsattlist(). - Doctree
- One parsed document.
root.kind == kinds::DOCUMENT. - Node
- One doctree node. Element nodes have
text == None; text leaves havekind == kinds::TEXT,Some(text), and no children or attributes. - Span
- Byte-offset range into a source file.
sourceindexes a per-doctree source table; wave 1 always uses source 0 (includearrives in wave 3).