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>Anchor id populated by the AssignHeadingIds transform (document-wide
dedupe). When None, slug() falls back to a per-heading computation.
Implementations§
Source§impl Heading
impl Heading
Sourcepub fn slug(&self) -> String
pub fn slug(&self) -> String
URL-anchor slug. Prefers the pre-computed id (only the document-scoped
pass can dedupe duplicates); else recomputes from 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; 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<Heading, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Heading, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Heading
impl Serialize for Heading
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more