mirror of
https://github.com/usememos/memos.git
synced 2025-01-04 11:33:06 +08:00
78 lines
1.1 KiB
Go
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
|
|
}
|