pub struct Heading {
pub level: u8,
pub children: Vec<Node>,
pub span: Span,
pub id: Option<String>,
}Fields§
§level: u8§children: Vec<Node>§span: Span§id: Option<String>Pre-computed anchor id, populated by the AssignHeadingIds transform
(github-slugger algorithm with document-wide dedupe). When None,
slug() falls back to a fresh per-heading computation, so headings
emitted before the transform pass still have a usable anchor.
Implementations§
Source§impl Heading
impl Heading
Sourcepub fn slug(&self) -> String
pub fn slug(&self) -> String
URL-anchor slug. Returns the pre-computed id when available
(preferred - only the document-scoped pass can dedupe duplicates),
else a one-shot github-slugger computation from the heading text.
Sourcepub fn plain_text(nodes: &[Node]) -> String
pub fn plain_text(nodes: &[Node]) -> String
Flatten inline nodes to bare text. Recurses through emphasis and link wrappers but skips JSX and images.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Heading
impl<'de> Deserialize<'de> for Heading
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Heading
Auto Trait Implementations§
impl Freeze for Heading
impl RefUnwindSafe for Heading
impl Send for Heading
impl Sync for Heading
impl Unpin for Heading
impl UnsafeUnpin for Heading
impl UnwindSafe for Heading
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