diff options
Diffstat (limited to 'src/syntax/tree.rs')
| -rw-r--r-- | src/syntax/tree.rs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/syntax/tree.rs b/src/syntax/tree.rs index 7295ec04..94dfc124 100644 --- a/src/syntax/tree.rs +++ b/src/syntax/tree.rs @@ -31,6 +31,8 @@ pub enum SyntaxNode { ToggleBolder, /// Plain text. Text(String), + /// Section headings. + Heading(Heading), /// Lines of raw text. Raw(Vec<String>), /// An optionally highlighted (multi-line) code block. @@ -39,6 +41,22 @@ pub enum SyntaxNode { Call(CallExpr), } +/// A section heading. +#[derive(Debug, Clone, PartialEq)] +pub struct Heading { + /// The section depth (how many hashtags minus 1). + pub level: Spanned<u8>, + pub tree: SyntaxTree, +} + +/// A code block. +#[derive(Debug, Clone, PartialEq)] +pub struct Code { + pub lang: Option<Spanned<Ident>>, + pub lines: Vec<String>, + pub block: bool, +} + /// An expression. #[derive(Clone, PartialEq)] pub enum Expr { @@ -197,10 +215,3 @@ impl CallExpr { } } } -/// A code block. -#[derive(Debug, Clone, PartialEq)] -pub struct Code { - pub lang: Option<Spanned<Ident>>, - pub lines: Vec<String>, - pub block: bool, -} |
