use serde::{Deserialize, Serialize};
#[derive(Debug, Clone)]
pub struct Heading {
pub level: u32,
pub title: String,
pub anchor: Option<String>,
pub position: usize,
}
#[derive(Debug, Clone)]
pub struct Table {
pub headers: Vec<String>,
pub rows: Vec<Vec<String>>,
pub alignments: Vec<TableAlignment>,
pub position: usize,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TableAlignment {
None,
Left,
Center,
Right,
}
#[derive(Debug, Clone)]
pub struct CodeBlock {
pub language: Option<String>,
pub filename: Option<String>,
pub content: String,
pub position: usize,
}
#[derive(Debug, Clone)]
pub struct Link {
pub raw: String,
pub target: String,
pub target_anchor: Option<String>,
pub is_external: bool,
pub exists_in_repository: bool,
}
#[derive(Debug, Clone)]
pub struct ParsedDocument {
pub path: String,
pub front_matter: Option<crate::model::document::frontmatter::FrontMatter>,
pub headings: Vec<Heading>,
pub links: Vec<Link>,
pub body_text: String,
pub sections: Vec<Section>,
pub parse_status: crate::model::document::frontmatter::ParseStatus,
pub parse_errors: Vec<crate::model::document::frontmatter::ParseError>,
}
#[derive(Debug, Clone)]
pub struct Section {
pub heading: String,
pub level: u32,
pub content: String,
pub start_position: usize,
pub tables: Vec<Table>,
pub code_blocks: Vec<CodeBlock>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HeadingInfo {
pub level: u32,
pub title: String,
pub anchor: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LinkInfo {
pub target_path: Option<String>,
pub target_anchor: Option<String>,
pub external_url: Option<String>,
pub exists_in_repository: bool,
}