init(navigationIndex : NavigationIndex , deprecatedPagePaths : Set<String>) init(navigationNavigationSidebarBuilder
Builds the navigation sidebar HTML from a navigation index.
struct NavigationSidebarBuilderOverview
The builder renders the complete navigation tree of all documented modules once, as the shared sidebar document described by Sidebar. The tree has:
-
Disclosure chevrons for expandable items (pure CSS, no JavaScript)
-
A stable
idon 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
Topic), whose drawing, like that of the chevron, is defined once at the start of the navigatorType Icon -
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 : 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
func buildNavigationTree () -> String buildfunc buildSidebarDocument (includeSearch : Bool) -> String buildstatic var sidebarScript : String sidebarstatic func buildFallbackSidebar () -> String buildstatic func rowPaths (in: NavigationIndex ) -> Set<String> rowstatic func rowTypes (in: NavigationIndex ) -> [String : String] rowRelationships
Swift.Sendable Swift.Sendable Metatype