Skip to main content

stillo_core/
ast.rs

1/// ページのセマンティック構造を表す中間表現。
2/// body_html → html_to_ast がビルドし、renderer が消費する。
3#[derive(Debug, Clone, Default)]
4pub struct Document {
5    pub blocks: Vec<Block>,
6}
7
8#[derive(Debug, Clone)]
9pub enum Block {
10    Heading { level: u8, inlines: Vec<Inline> },
11    Paragraph(Vec<Inline>),
12    /// 深さ情報付きリストアイテム(フラット構造で深さをインデントで表現)
13    ListItem { depth: usize, ordered: bool, number: usize, inlines: Vec<Inline> },
14    CodeBlock { lang: Option<String>, content: String },
15    Blockquote(Vec<Inline>),
16    Rule,
17}
18
19#[derive(Debug, Clone)]
20pub enum Inline {
21    Text(String),
22    Bold(String),
23    Italic(String),
24    BoldItalic(String),
25    Code(String),
26    Link { text: String, href: String },
27    SoftBreak,
28}