This commit is contained in:
Daniel 2024-11-15 22:42:33 +08:00
parent 7b342fc004
commit a2a46f8f39
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 4 additions and 22 deletions

View file

@ -23,16 +23,13 @@ import (
"unicode/utf8"
"github.com/88250/gulu"
"github.com/88250/lute/lex"
"github.com/siyuan-note/siyuan/kernel/util"
)
func MarkText(text string, keyword string, beforeLen int, caseSensitive bool) (pos int, marked string) {
if "" == keyword {
return -1, util.EscapeHTML(text)
return -1, text
}
text = util.EscapeHTML(text)
keywords := SplitKeyword(keyword)
marked = EncloseHighlighting(text, keywords, "<mark>", "</mark>", caseSensitive, false)