mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-28 19:26:09 +01:00
🎨 Improve search preview to highlight text <foo> https://github.com/siyuan-note/siyuan/issues/9821
This commit is contained in:
parent
16fa8a4548
commit
0b723479f1
3 changed files with 9 additions and 5 deletions
|
|
@ -1102,7 +1102,12 @@ func stringQuery(query string) string {
|
|||
func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markSpanDataType string, luteEngine *lute.Lute) bool {
|
||||
text := n.Content()
|
||||
if ast.NodeText == n.Type {
|
||||
text = search.EncloseHighlighting(text, keywords, search.GetMarkSpanStart(markSpanDataType), search.GetMarkSpanEnd(), Conf.Search.CaseSensitive, false)
|
||||
text = util.EscapeHTML(text)
|
||||
escapedKeywords := make([]string, len(keywords))
|
||||
for i, keyword := range keywords {
|
||||
escapedKeywords[i] = util.EscapeHTML(keyword)
|
||||
}
|
||||
text = search.EncloseHighlighting(text, escapedKeywords, search.GetMarkSpanStart(markSpanDataType), search.GetMarkSpanEnd(), Conf.Search.CaseSensitive, false)
|
||||
n.Tokens = gulu.Str.ToBytes(text)
|
||||
if bytes.Contains(n.Tokens, []byte(search.MarkDataType)) {
|
||||
linkTree := parse.Inline("", n.Tokens, luteEngine.ParseOptions)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue