Programmatic construction of a document — the write-path mirror of
Document::parse. Build the tree bottom-up (add children, then the
container, wiring them with Builder::set_children); every add* method
returns the new node’s NodeId. Then render, serialize, query, or dump the
subtree rooted at any id, on demand, without consuming the builder. All input
strings are copied, so caller buffers need not outlive a call.
The byte-level effect of an Editor edit: old is the range of the
pre-edit source that was replaced, new the range the replacement now
occupies in the post-edit source (they share a start). An insertion has an
empty old; a deletion an empty new. Everything a caret/selection needs
to re-anchor across an edit without re-diffing: shift any offset >= old.end
by new.len() - old.len().
A span-splice editor over a document: applies lossless, in-place edits and
reparses after each one, so node addressing stays valid as the document
evolves. Every op is addressed by a locator — a dot-separated index path
("0.3.1") or a selector that must match exactly one node
(heading("Status")). A failed edit leaves the document unchanged.
One node of an Editor::nodes snapshot — the flat AST arena as owned Rust
data (the JSON-free read path). id indexes the snapshot; parent,
first_child, and next_sibling link the tree (None where absent).
text is the node’s primary payload (a str’s bytes, a code_block’s
body, …) and destination a link/image target, each None when the kind
carries no such payload.
The id of a node added to a Builder, returned by every add* method and
used to wire up the tree via Builder::set_children and to root a
render/serialize/query.
The C ABI contract version this crate was compiled against — the
compile-time counterpart to abi_version (which reports the linked
library’s). This crate builds and links its own vendored copy of the Zig
source, so the two always agree; the pair is exposed so a consumer embedding
a separately-built library can verify layout compatibility at load time.
The C ABI contract version of the linked library. This crate is written
against ABI_VERSION; the two agreeing is what makes the #[repr(C)]
mirrors in ffi sound. It is bumped only on a breaking ABI change (a struct
layout change or a renumbered enum value), never on an additive one (a new
format code or a new function).