use alloc::{string::String, vec::Vec};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Document {
pub contents: Vec<GemtextContentBlock>,
}
impl Document {
pub fn parse_from_gemtext(document: &str) -> Self {
document.parse().expect("infallible")
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum GemtextContentBlock {
Text {
content: String,
},
Link {
target: String,
label: Option<String>,
},
Heading {
level: HeadingLevel,
content: String,
},
List {
items: Vec<String>,
},
Quote {
content: String,
},
Pre {
alt_text: Option<String>,
content: String,
},
Ignored {
content: String,
},
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[non_exhaustive]
pub enum HeadingLevel {
One,
Two,
Three,
}