mirror of
https://github.com/usememos/memos.git
synced 2025-01-04 11:33:06 +08:00
43 lines
620 B
Go
43 lines
620 B
Go
|
package ast
|
||
|
|
||
|
type BaseBlock struct {
|
||
|
}
|
||
|
|
||
|
type Paragraph struct {
|
||
|
BaseBlock
|
||
|
|
||
|
Children []Node
|
||
|
}
|
||
|
|
||
|
var NodeTypeParagraph = NewNodeType("Paragraph")
|
||
|
|
||
|
func NewParagraph(children []Node) *Paragraph {
|
||
|
return &Paragraph{
|
||
|
Children: children,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (*Paragraph) Type() NodeType {
|
||
|
return NodeTypeParagraph
|
||
|
}
|
||
|
|
||
|
type CodeBlock struct {
|
||
|
BaseBlock
|
||
|
|
||
|
Language string
|
||
|
Content string
|
||
|
}
|
||
|
|
||
|
var NodeTypeCodeBlock = NewNodeType("CodeBlock")
|
||
|
|
||
|
func NewCodeBlock(language, content string) *CodeBlock {
|
||
|
return &CodeBlock{
|
||
|
Language: language,
|
||
|
Content: content,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (*CodeBlock) Type() NodeType {
|
||
|
return NodeTypeCodeBlock
|
||
|
}
|