mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🎨 Improve search highlighting https://github.com/siyuan-note/siyuan/issues/13343
This commit is contained in:
parent
6d42df1a29
commit
f024e3b07d
1 changed files with 10 additions and 0 deletions
|
|
@ -801,6 +801,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
||||||
|
|
||||||
subTree := &parse.Tree{ID: rootID, Root: &ast.Node{Type: ast.NodeDocument}, Marks: tree.Marks}
|
subTree := &parse.Tree{ID: rootID, Root: &ast.Node{Type: ast.NodeDocument}, Marks: tree.Marks}
|
||||||
|
|
||||||
|
query = filterQueryInvisibleChars(query)
|
||||||
if "" != query && (0 == queryMethod || 1 == queryMethod || 3 == queryMethod) { // 只有关键字、查询语法和正则表达式搜索支持高亮
|
if "" != query && (0 == queryMethod || 1 == queryMethod || 3 == queryMethod) { // 只有关键字、查询语法和正则表达式搜索支持高亮
|
||||||
if 0 == queryMethod {
|
if 0 == queryMethod {
|
||||||
query = stringQuery(query)
|
query = stringQuery(query)
|
||||||
|
|
@ -883,6 +884,15 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
||||||
luteEngine.RenderOptions.NodeIndexStart = index
|
luteEngine.RenderOptions.NodeIndexStart = index
|
||||||
dom = luteEngine.Tree2BlockDOM(subTree, luteEngine.RenderOptions)
|
dom = luteEngine.Tree2BlockDOM(subTree, luteEngine.RenderOptions)
|
||||||
|
|
||||||
|
if 1 > len(keywords) {
|
||||||
|
keywords = []string{}
|
||||||
|
}
|
||||||
|
for i, keyword := range keywords {
|
||||||
|
keyword = strings.TrimPrefix(keyword, "#")
|
||||||
|
keyword = strings.TrimSuffix(keyword, "#")
|
||||||
|
keywords[i] = keyword
|
||||||
|
}
|
||||||
|
|
||||||
go setRecentDocByTree(tree)
|
go setRecentDocByTree(tree)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue