memos/plugin/gomark/ast/block.go
2023-12-13 21:00:13 +08:00

78 lines
1.1 KiB
Go

package ast
type BaseBlock struct {
Node
}
type LineBreak struct {
BaseBlock
}
var NodeTypeLineBreak = NewNodeType("LineBreak")
func (*LineBreak) Type() NodeType {
return NodeTypeLineBreak
}
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
}
type Heading struct {
BaseBlock
Level int
Children []Node
}
var NodeTypeHeading = NewNodeType("Heading")
func (*Heading) Type() NodeType {
return NodeTypeHeading
}
type HorizontalRule struct {
BaseBlock
// Symbol is "*" or "-" or "_".
Symbol string
}
var NodeTypeHorizontalRule = NewNodeType("HorizontalRule")
func (*HorizontalRule) Type() NodeType {
return NodeTypeHorizontalRule
}
type Blockquote struct {
BaseBlock
Children []Node
}
var NodeTypeBlockquote = NewNodeType("Blockquote")
func (*Blockquote) Type() NodeType {
return NodeTypeBlockquote
}