Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Search results preview contains escape character issue https://github.com/siyuan-note/siyuan/issues/9790

Daniel1da871ac5b02
diff --git a/kernel/search/mark.go b/kernel/search/mark.go
index a4481c9f9e..b5806ce774 100644
--- a/kernel/search/mark.go
+++ b/kernel/search/mark.go
@@ -116,6 +116,9 @@ func EncloseHighlighting(text string, keywords []string, openMark, closeMark str
if reg, err := regexp.Compile(re); nil == err {
ret = reg.ReplaceAllStringFunc(text, func(s string) string { return openMark + s + closeMark })
}
+
+ // 搜索结果预览包含转义符问题 Search results preview contains escape character issue https://github.com/siyuan-note/siyuan/issues/9790
+ ret = strings.ReplaceAll(ret, "\\<span", "\\\\<span ")
return
}