pub struct Headings<'a> { /* private fields */ }Expand description
Headings extracted from a Markdown document.
This helper is useful for building a table of contents. It walks the tree
in document order, converts each heading to plain text, and assigns unique
anchors to repeated headings. Anchor assignment includes headings filtered
out by HeadingOptions, so the remaining anchors still match rendered
headings when CompileOptions::heading_ids
is enabled.
Implementations§
Source§impl<'a> Headings<'a>
impl<'a> Headings<'a>
Sourcepub fn extract_with_options(root: &'a Node, options: &HeadingOptions) -> Self
pub fn extract_with_options(root: &'a Node, options: &HeadingOptions) -> Self
Extract headings from a document tree with a level range.
Sourcepub fn as_slice(&self) -> &[HeadingEntry<'a>]
pub fn as_slice(&self) -> &[HeadingEntry<'a>]
Return the extracted entries as a slice.
Sourcepub fn iter(&self) -> Iter<'_, HeadingEntry<'a>> ⓘ
pub fn iter(&self) -> Iter<'_, HeadingEntry<'a>> ⓘ
Iterate over the extracted entries in document order.
Trait Implementations§
impl<'a> Eq for Headings<'a>
Source§impl<'a, 'b> IntoIterator for &'b Headings<'a>
impl<'a, 'b> IntoIterator for &'b Headings<'a>
Source§impl<'a> IntoIterator for Headings<'a>
impl<'a> IntoIterator for Headings<'a>
impl<'a> StructuralPartialEq for Headings<'a>
Auto Trait Implementations§
impl<'a> Freeze for Headings<'a>
impl<'a> RefUnwindSafe for Headings<'a>
impl<'a> Send for Headings<'a>
impl<'a> Sync for Headings<'a>
impl<'a> Unpin for Headings<'a>
impl<'a> UnsafeUnpin for Headings<'a>
impl<'a> UnwindSafe for Headings<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more