2023-12-12 23:24:02 +08:00
|
|
|
package ast
|
|
|
|
|
|
|
|
type BaseBlock struct {
|
|
|
|
}
|
|
|
|
|
2023-12-12 23:38:43 +08:00
|
|
|
type LineBreak struct {
|
|
|
|
BaseBlock
|
|
|
|
}
|
|
|
|
|
|
|
|
var NodeTypeLineBreak = NewNodeType("LineBreak")
|
|
|
|
|
|
|
|
func (*LineBreak) Type() NodeType {
|
|
|
|
return NodeTypeLineBreak
|
|
|
|
}
|
|
|
|
|
2023-12-12 23:24:02 +08:00
|
|
|
type Paragraph struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Children []Node
|
|
|
|
}
|
|
|
|
|
|
|
|
var NodeTypeParagraph = NewNodeType("Paragraph")
|
|
|
|
|
|
|
|
func (*Paragraph) Type() NodeType {
|
|
|
|
return NodeTypeParagraph
|
|
|
|
}
|
|
|
|
|
|
|
|
type CodeBlock struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Language string
|
|
|
|
Content string
|
|
|
|
}
|
|
|
|
|
|
|
|
var NodeTypeCodeBlock = NewNodeType("CodeBlock")
|
|
|
|
|
|
|
|
func (*CodeBlock) Type() NodeType {
|
|
|
|
return NodeTypeCodeBlock
|
|
|
|
}
|
2023-12-13 09:06:47 +08:00
|
|
|
|
|
|
|
type Heading struct {
|
|
|
|
BaseBlock
|
|
|
|
|
|
|
|
Level int
|
|
|
|
Children []Node
|
|
|
|
}
|
|
|
|
|
|
|
|
var NodeTypeHeading = NewNodeType("Heading")
|
|
|
|
|
|
|
|
func (*Heading) Type() NodeType {
|
|
|
|
return NodeTypeHeading
|
|
|
|
}
|