2023-12-12 23:24:02 +08:00
|
|
|
package ast
|
|
|
|
|
|
|
|
type BaseBlock struct {
|
2023-12-13 23:50:05 +08:00
|
|
|
BaseNode
|
2023-12-12 23:24:02 +08:00
|
|
|
}
|
|
|
|
|
2023-12-12 23:38:43 +08:00
|
|
|
type LineBreak struct {
|
|
|
|
BaseBlock
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*LineBreak) Type() NodeType {
|
2023-12-14 22:21:23 +08:00
|
|
|
return LineBreakNode
|
2023-12-13 23:50:05 +08:00
|
|
|
}
|
|
|
|
|
2023-12-12 23:24:02 +08:00
|
|
|
type Paragraph struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Children []Node
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Paragraph) Type() NodeType {
|
2023-12-14 22:21:23 +08:00
|
|
|
return ParagraphNode
|
2023-12-13 23:50:05 +08:00
|
|
|
}
|
|
|
|
|
2023-12-12 23:24:02 +08:00
|
|
|
type CodeBlock struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Language string
|
|
|
|
Content string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*CodeBlock) Type() NodeType {
|
2023-12-14 22:21:23 +08:00
|
|
|
return CodeBlockNode
|
2023-12-13 23:50:05 +08:00
|
|
|
}
|
|
|
|
|
2023-12-13 09:06:47 +08:00
|
|
|
type Heading struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Level int
|
|
|
|
Children []Node
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Heading) Type() NodeType {
|
2023-12-14 22:21:23 +08:00
|
|
|
return HeadingNode
|
2023-12-13 23:50:05 +08:00
|
|
|
}
|
|
|
|
|
2023-12-13 21:00:13 +08:00
|
|
|
type HorizontalRule struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
// Symbol is "*" or "-" or "_".
|
|
|
|
Symbol string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*HorizontalRule) Type() NodeType {
|
2023-12-14 22:21:23 +08:00
|
|
|
return HorizontalRuleNode
|
2023-12-13 23:50:05 +08:00
|
|
|
}
|
|
|
|
|
2023-12-13 21:00:13 +08:00
|
|
|
type Blockquote struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Children []Node
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Blockquote) Type() NodeType {
|
2023-12-14 22:21:23 +08:00
|
|
|
return BlockquoteNode
|
2023-12-13 23:50:05 +08:00
|
|
|
}
|
2023-12-16 08:51:29 +08:00
|
|
|
|
|
|
|
type OrderedList struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Number string
|
|
|
|
Children []Node
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*OrderedList) Type() NodeType {
|
|
|
|
return OrderedListNode
|
|
|
|
}
|
|
|
|
|
|
|
|
type UnorderedList struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
// Symbol is "*" or "-" or "+".
|
|
|
|
Symbol string
|
|
|
|
Children []Node
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*UnorderedList) Type() NodeType {
|
|
|
|
return UnorderedListNode
|
|
|
|
}
|