mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 间隔复习界面面包屑不包含标记元素
This commit is contained in:
parent
855b92f4ca
commit
3db25a7259
8 changed files with 38 additions and 17 deletions
|
|
@ -18,6 +18,7 @@ package treenode
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/88250/gulu"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ func IsBlockRef(n *ast.Node) bool {
|
|||
|
||||
func NodeStaticMdContent(node *ast.Node, luteEngine *lute.Lute) (md, content string) {
|
||||
md = ExportNodeStdMd(node, luteEngine)
|
||||
content = NodeStaticContent(node)
|
||||
content = NodeStaticContent(node, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +75,7 @@ func ExportNodeStdMd(node *ast.Node, luteEngine *lute.Lute) string {
|
|||
return markdown
|
||||
}
|
||||
|
||||
func NodeStaticContent(node *ast.Node) string {
|
||||
func NodeStaticContent(node *ast.Node, excludeTypes []string) string {
|
||||
if nil == node {
|
||||
return ""
|
||||
}
|
||||
|
|
@ -99,6 +100,10 @@ func NodeStaticContent(node *ast.Node) string {
|
|||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if gulu.Str.Contains(n.Type.String(), excludeTypes) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
switch n.Type {
|
||||
case ast.NodeLinkText:
|
||||
buf.Write(n.Tokens)
|
||||
|
|
@ -116,6 +121,14 @@ func NodeStaticContent(node *ast.Node) string {
|
|||
}
|
||||
buf.Write(tokens)
|
||||
case ast.NodeTextMark:
|
||||
for _, excludeType := range excludeTypes {
|
||||
if strings.HasPrefix(excludeType, "TextMark-") {
|
||||
if n.IsTextMarkType(excludeType[9:]) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if n.IsTextMarkType("tag") {
|
||||
buf.WriteByte('#')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue