Skip to main content

render_toc

Function render_toc 

Source
pub fn render_toc(headings: &[Heading]) -> String
Expand description

The outline an <nav class="toc"> holds: a nested list of the page’s h2h3 headings, each linking to its anchor.

Empty — no element at all — when there are fewer than two of them: an outline of one entry is a heading the reader can already see. Levels above h2 are left out because a body’s h1 is its title, and below h3 because an outline that lists every h5 is the page again.