Table of Contents (TOC) generation for Wikidot markup.
Converts a flat array of TocEntry items (collected from heading elements
during parsing) into nested bullet-list Element nodes suitable for rendering
as [[toc]]. Uses the depth module to transform flat heading levels (h1-h6)
into a properly nested list hierarchy.
Each TOC entry becomes an anchor link (#toc0, #toc1, ...) pointing to the
corresponding heading in the rendered page, matching Wikidot's original
anchor naming scheme.
Table of Contents (TOC) generation for Wikidot markup.
Converts a flat array of
TocEntryitems (collected from heading elements during parsing) into nested bullet-listElementnodes suitable for rendering as[[toc]]. Uses the depth module to transform flat heading levels (h1-h6) into a properly nested list hierarchy.Each TOC entry becomes an anchor link (
#toc0,#toc1, ...) pointing to the corresponding heading in the rendered page, matching Wikidot's original anchor naming scheme.