Skip to content

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

:art: 搜索替换支持块引锚文本 Fix https://github.com/siyuan-note/siyuan/issues/5903

Liang Dingafe14a990f5c
diff --git a/kernel/model/search.go b/kernel/model/search.go
index ba8c9a9053..cd1ef05d21 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -166,9 +166,13 @@ func FindReplace(keyword, replacement string, ids []string) (err error) {
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte(keyword), []byte(replacement))
}
case ast.NodeTextMark:
- if strings.Contains(n.TextMarkTextContent, keyword) || strings.Contains(n.TextMarkInlineMathContent, keyword) || strings.Contains(n.TextMarkInlineMemoContent, keyword) {
+ if strings.Contains(n.TextMarkTextContent, keyword) {
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
+ }
+ if strings.Contains(n.TextMarkInlineMathContent, keyword) {
n.TextMarkInlineMathContent = strings.ReplaceAll(n.TextMarkInlineMathContent, keyword, replacement)
+ }
+ if strings.Contains(n.TextMarkInlineMemoContent, keyword) {
n.TextMarkInlineMemoContent = strings.ReplaceAll(n.TextMarkInlineMemoContent, keyword, replacement)
}
}