mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 搜索结果高亮支持大部分行级元素 https://github.com/siyuan-note/siyuan/issues/6745
This commit is contained in:
parent
dc72c05d18
commit
3d92974f9e
4 changed files with 22 additions and 21 deletions
|
|
@ -644,7 +644,6 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
|
|||
n.Tokens = gulu.Str.ToBytes(text)
|
||||
}
|
||||
|
||||
if ast.NodeText == n.Type {
|
||||
if 0 < len(keywords) {
|
||||
hitBlock := false
|
||||
for p := n.Parent; nil != p; p = p.Parent {
|
||||
|
|
@ -663,7 +662,6 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
|
|||
if processVirtualRef(n, &unlinks, virtualBlockRefKeywords, refCount, luteEngine) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -177,13 +177,11 @@ func GetDocHistoryContent(historyPath, keyword string) (id, rootID, content stri
|
|||
n.RemoveIALAttr("heading-fold")
|
||||
n.RemoveIALAttr("fold")
|
||||
|
||||
if ast.NodeText == n.Type {
|
||||
if 0 < len(keywords) {
|
||||
if markReplaceSpan(n, &unlinks, keywords, searchMarkDataType, luteEngine) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -893,6 +893,7 @@ func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markS
|
|||
}
|
||||
} else if ast.NodeTextMark == n.Type {
|
||||
// TODO 搜索结果高亮支持大部分行级元素 https://github.com/siyuan-note/siyuan/issues/6745
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ func processVirtualRef(n *ast.Node, unlinks *[]*ast.Node, virtualBlockRefKeyword
|
|||
return false
|
||||
}
|
||||
|
||||
if ast.NodeText != n.Type {
|
||||
return false
|
||||
}
|
||||
|
||||
parentBlock := treenode.ParentBlock(n)
|
||||
if nil == parentBlock || 0 < refCount[parentBlock.ID] {
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue