Skip Navigation
StructureStructure

NavigationSidebarBuilder

Builds the navigation sidebar HTML from a navigation index.

struct NavigationSidebarBuilder

Overview

The builder renders the complete navigation tree of all documented modules once, as the shared sidebar document described by SidebarDocument. The tree has:

  • Disclosure chevrons for expandable items (pure CSS, no JavaScript)

  • A stable id on every row, derived from the row’s documentation path, so that the page embedding the document can select its row with a URL fragment

  • The topic type icon of every row (see TopicTypeIcon), whose drawing, like that of the chevron, is defined once at the start of the navigator

  • Flat list structure (matches swift-docc-render architecture)

The shared document carries no per-page state: highlighting the current page and expanding its ancestors is done by the stylesheet through the :target pseudo-class.

Architecture

The builder generates a flat list where items are siblings in a single <ul>, and the children of an item follow it in a .nav-children-wrapper list item. Visual hierarchy is achieved through CSS: the stylesheet derives the --nesting-index custom property, which indents the row, from the row’s data-nesting-index attribute.

Group markers (e.g., “Initializers”, “Instance Methods”) are regular <li> items with the .is-group class, at the same depth as the rows they group.

This matches the swift-docc-render Vue.js implementation where items are flattened during rendering with depth-based indentation.

Topics

Relationships

  • Swift.Sendable
  • Swift.SendableMetatype