Skip to main content

assign_heading_ids

Function assign_heading_ids 

Source
pub fn assign_heading_ids(html: String, policy: HeadingIdPolicy) -> String
Expand description

Assigns an id attribute to every heading in html that doesn’t already have one, according to policy. A heading’s existing id — whether an explicit Markdown {#id} heading attribute or one another renderer already assigned (e.g. RST’s own auto-ids) — always wins and is never touched. Markup-language agnostic: this runs on the final rendered HTML, after markup_to_html has already produced <h1>-<h6> tags, regardless of which renderer produced them.