mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
✨ Callout block https://github.com/siyuan-note/siyuan/issues/16051
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
362f6ffa05
commit
980f6dd0b8
9 changed files with 26 additions and 12 deletions
|
|
@ -224,7 +224,7 @@ func FirstLeafBlock(node *ast.Node) (ret *ast.Node) {
|
|||
|
||||
func CountBlockNodes(node *ast.Node) (ret int) {
|
||||
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || !n.IsBlock() || ast.NodeList == n.Type || ast.NodeBlockquote == n.Type || ast.NodeSuperBlock == n.Type {
|
||||
if !entering || !n.IsBlock() || ast.NodeList == n.Type || ast.NodeBlockquote == n.Type || ast.NodeSuperBlock == n.Type || ast.NodeCallout == n.Type {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
|
|
@ -403,6 +403,7 @@ var typeAbbrMap = map[string]string{
|
|||
"NodeThematicBreak": "tb",
|
||||
"NodeVideo": "video",
|
||||
"NodeAudio": "audio",
|
||||
"NodeCallout": "callout",
|
||||
// 行级元素
|
||||
"NodeText": "text",
|
||||
"NodeImage": "img",
|
||||
|
|
@ -458,6 +459,8 @@ func SubTypeAbbr(n *ast.Node) string {
|
|||
if 6 == n.HeadingLevel {
|
||||
return "h6"
|
||||
}
|
||||
case ast.NodeCallout:
|
||||
return n.CalloutType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue