🎨 Improve highlighting of numbers and letters in global search preview Fix https://github.com/siyuan-note/siyuan/issues/8100

This commit is contained in:
Liang Ding 2023-04-25 11:16:48 +08:00
parent 2494412f77
commit a5be0036e9
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 10 additions and 7 deletions

View file

@ -676,7 +676,7 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
// 支持代码块搜索定位 https://github.com/siyuan-note/siyuan/issues/5520
if ast.NodeCodeBlockCode == n.Type && 0 < len(keywords) && !treenode.IsChartCodeBlockCode(n) {
text := string(n.Tokens)
text = search.EncloseHighlighting(text, keywords, search.SearchMarkLeft, search.SearchMarkRight, Conf.Search.CaseSensitive)
text = search.EncloseHighlighting(text, keywords, search.SearchMarkLeft, search.SearchMarkRight, Conf.Search.CaseSensitive, false)
n.Tokens = gulu.Str.ToBytes(text)
}