Tree Operations
Creates a new node object. If
id is omitted a unique ID is generated
automatically. Pass a fixed id when you need deterministic output (e.g. SSR
/ hydration-safe initial documents).Deeply clones a node and its children, generating new IDs for all.
Finds a node by ID within a tree.
Finds the parent of a given node ID.
Returns an array of all nodes in the tree.
Document Management
Creates a fresh document with a default structure (Container > Section > Text).
Checks a document for errors (missing required fields, duplicate IDs, etc.).
Returns an array of error messages.
Returns the path of indices from the root to the node.
Generates a unique ID for a node.
