Depth processing module for converting flat lists into nested tree structures.
This is a TypeScript port of Wikidot's depth.rs. It handles the conversion
of flat depth-annotated items (such as bullet/numbered list entries at various
indentation levels) into properly nested tree structures. The algorithm uses an
internal stack to track open nesting levels and collapses them as depth decreases.
Used primarily by the list parser and the table-of-contents builder to transform
flat sequences of items with depth annotations into hierarchical AST structures.
Depth processing module for converting flat lists into nested tree structures.
This is a TypeScript port of Wikidot's
depth.rs. It handles the conversion of flat depth-annotated items (such as bullet/numbered list entries at various indentation levels) into properly nested tree structures. The algorithm uses an internal stack to track open nesting levels and collapses them as depth decreases.Used primarily by the list parser and the table-of-contents builder to transform flat sequences of items with depth annotations into hierarchical AST structures.