use std::fmt::Display; #[derive(Debug, PartialEq)] pub enum Inline { Bold { inner: Vec }, Italic { inner: Vec }, Link { inner: Vec, href: Href }, Code { content: String }, Text { content: String }, } #[derive(Debug, PartialEq)] pub struct Href(pub String); impl Href { pub fn new(href: &str) -> Self { // can check for link correctness Self(href.to_string()) } } impl Display for Href { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) } } #[derive(Debug, PartialEq)] pub enum Block { Heading { inner: Vec, level: u8 }, Code { content: String, lang: String }, Quote { inner: Box }, Paragraph { inner: Vec }, List { ordered: bool, items: Vec }, Null, }