Skip to main content

resolve_toctree

Function resolve_toctree 

Source
pub fn resolve_toctree(
    env: &BuildEnvironment,
    docname: &str,
    toctree: &Node,
) -> Option<Node>
Expand description

Resolve a toctree node into the nested bullet lists Sphinx writes in its place: _resolve_toctree (adapters/toctree.py:119-220) with the arguments the write phase passes for a document’s own toctrees (get_and_resolve_doctree: prune=True, the node’s own maxdepth, collapse=False, includehidden=False).

None is Sphinx’s “renders to nothing”: a hidden toctree, one with no entries, or one whose entries all name documents without a title.

The result carries exactly what the search index reads from the resolved tree — the caption as a title, every entry’s title text inside reference nodes, pruned to maxdepth/titlesonly/tocdepth like Sphinx prunes it. Still missing for the HTML writer: the toctree-l<N>/current classes and iscurrent marks, the relative refuris, and the circular toctree references detected warning (the circular entry is dropped as Sphinx drops it, but nothing is logged). only nodes are kept with their children: Sphinx evaluates them against the build tags, which this crate does not evaluate anywhere yet.