Skip to content

Commit

Permalink
hotfix (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurk authored Nov 29, 2023
1 parent 80ea636 commit 9335178
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/nodes/heading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ use crate::toolkit::{
use super::{anchor::Anchor, text::Text};

#[derive(Debug, PartialEq, Serialize, Clone)]
#[serde(tag = "type")]
pub enum HeadingNodes {
Text(Text),
Anchor(Anchor),
A(Anchor),
}

impl From<Text> for HeadingNodes {
Expand All @@ -25,15 +26,15 @@ impl From<Text> for HeadingNodes {

impl From<Anchor> for HeadingNodes {
fn from(anchor: Anchor) -> Self {
Self::Anchor(anchor)
Self::A(anchor)
}
}

impl Node for HeadingNodes {
fn len(&self) -> usize {
match self {
Self::Text(text) => text.len(),
Self::Anchor(anchor) => anchor.len(),
Self::A(anchor) => anchor.len(),
}
}
}
Expand All @@ -42,7 +43,7 @@ impl Display for HeadingNodes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Text(text) => write!(f, "{}", text),
Self::Anchor(anchor) => write!(f, "{}", anchor),
Self::A(anchor) => write!(f, "{}", anchor),
}
}
}
Expand Down

0 comments on commit 9335178

Please sign in to comment.