memos/plugin/gomark/ast/inline.go

124 lines
1.4 KiB
Go
Raw Normal View History

2023-12-12 23:24:02 +08:00
package ast
2023-12-13 21:00:13 +08:00
type BaseInline struct {
2023-12-13 23:50:05 +08:00
BaseNode
2023-12-13 21:00:13 +08:00
}
2023-12-12 23:24:02 +08:00
type Text struct {
BaseInline
Content string
}
func (*Text) Type() NodeType {
2023-12-14 22:21:23 +08:00
return TextNode
2023-12-13 23:50:05 +08:00
}
2023-12-12 23:24:02 +08:00
type Bold struct {
BaseInline
2023-12-13 23:50:05 +08:00
// Symbol is "*" or "_".
2023-12-16 10:09:20 +08:00
Symbol string
Children []Node
2023-12-12 23:24:02 +08:00
}
func (*Bold) Type() NodeType {
2023-12-14 22:21:23 +08:00
return BoldNode
2023-12-13 23:50:05 +08:00
}
2023-12-13 21:00:13 +08:00
type Italic struct {
BaseInline
2023-12-13 23:50:05 +08:00
// Symbol is "*" or "_".
2023-12-13 21:00:13 +08:00
Symbol string
Content string
}
func (*Italic) Type() NodeType {
2023-12-14 22:21:23 +08:00
return ItalicNode
2023-12-13 23:50:05 +08:00
}
2023-12-13 21:00:13 +08:00
type BoldItalic struct {
BaseInline
2023-12-13 23:50:05 +08:00
// Symbol is "*" or "_".
2023-12-13 21:00:13 +08:00
Symbol string
Content string
}
func (*BoldItalic) Type() NodeType {
2023-12-14 22:21:23 +08:00
return BoldItalicNode
2023-12-13 23:50:05 +08:00
}
2023-12-13 09:06:47 +08:00
type Code struct {
BaseInline
Content string
}
func (*Code) Type() NodeType {
2023-12-14 22:21:23 +08:00
return CodeNode
2023-12-13 23:50:05 +08:00
}
2023-12-13 09:06:47 +08:00
type Image struct {
BaseInline
AltText string
URL string
}
func (*Image) Type() NodeType {
2023-12-14 22:21:23 +08:00
return ImageNode
2023-12-13 23:50:05 +08:00
}
2023-12-13 09:06:47 +08:00
type Link struct {
BaseInline
Text string
URL string
}
func (*Link) Type() NodeType {
2023-12-14 22:21:23 +08:00
return LinkNode
2023-12-13 23:50:05 +08:00
}
2023-12-27 08:44:51 +08:00
type AutoLink struct {
BaseInline
URL string
}
func (*AutoLink) Type() NodeType {
return AutoLinkNode
}
2023-12-13 21:00:13 +08:00
type Tag struct {
2023-12-13 09:06:47 +08:00
BaseInline
Content string
}
2023-12-13 21:00:13 +08:00
func (*Tag) Type() NodeType {
2023-12-14 22:21:23 +08:00
return TagNode
2023-12-13 23:50:05 +08:00
}
2023-12-13 21:00:13 +08:00
type Strikethrough struct {
2023-12-13 09:06:47 +08:00
BaseInline
Content string
}
2023-12-13 21:00:13 +08:00
func (*Strikethrough) Type() NodeType {
2023-12-14 22:21:23 +08:00
return StrikethroughNode
2023-12-13 23:50:05 +08:00
}
type EscapingCharacter struct {
BaseInline
Symbol string
}
func (*EscapingCharacter) Type() NodeType {
return EscapingCharacterNode
}