memos/plugin/gomark/ast/block.go
2023-12-12 23:24:02 +08:00

42 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
}