mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: implement part of nodes
This commit is contained in:
@@ -10,12 +10,6 @@ type Text struct {
|
||||
|
||||
var NodeTypeText = NewNodeType("Text")
|
||||
|
||||
func NewText(content string) *Text {
|
||||
return &Text{
|
||||
Content: content,
|
||||
}
|
||||
}
|
||||
|
||||
func (*Text) Type() NodeType {
|
||||
return NodeTypeText
|
||||
}
|
||||
@@ -30,13 +24,70 @@ type Bold struct {
|
||||
|
||||
var NodeTypeBold = NewNodeType("Bold")
|
||||
|
||||
func NewBold(symbol, content string) *Bold {
|
||||
return &Bold{
|
||||
Symbol: symbol,
|
||||
Content: content,
|
||||
}
|
||||
}
|
||||
|
||||
func (*Bold) Type() NodeType {
|
||||
return NodeTypeBold
|
||||
}
|
||||
|
||||
type Code struct {
|
||||
BaseInline
|
||||
|
||||
Content string
|
||||
}
|
||||
|
||||
var NodeTypeCode = NewNodeType("Code")
|
||||
|
||||
func (*Code) Type() NodeType {
|
||||
return NodeTypeCode
|
||||
}
|
||||
|
||||
type Image struct {
|
||||
BaseInline
|
||||
|
||||
AltText string
|
||||
URL string
|
||||
}
|
||||
|
||||
var NodeTypeImage = NewNodeType("Image")
|
||||
|
||||
func (*Image) Type() NodeType {
|
||||
return NodeTypeImage
|
||||
}
|
||||
|
||||
type Link struct {
|
||||
BaseInline
|
||||
|
||||
Text string
|
||||
URL string
|
||||
}
|
||||
|
||||
var NodeTypeLink = NewNodeType("Link")
|
||||
|
||||
func (*Link) Type() NodeType {
|
||||
return NodeTypeLink
|
||||
}
|
||||
|
||||
type Italic struct {
|
||||
BaseInline
|
||||
|
||||
// Symbol is "*" or "_"
|
||||
Symbol string
|
||||
Content string
|
||||
}
|
||||
|
||||
var NodeTypeItalic = NewNodeType("Italic")
|
||||
|
||||
func (*Italic) Type() NodeType {
|
||||
return NodeTypeItalic
|
||||
}
|
||||
|
||||
type Tag struct {
|
||||
BaseInline
|
||||
|
||||
Content string
|
||||
}
|
||||
|
||||
var NodeTypeTag = NewNodeType("Tag")
|
||||
|
||||
func (*Tag) Type() NodeType {
|
||||
return NodeTypeTag
|
||||
}
|
||||
|
Reference in New Issue
Block a user