Skip to content

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

:art: Improve link dest https://github.com/siyuan-note/siyuan/issues/13497

Danielf3853ee842a8
diff --git a/kernel/model/search.go b/kernel/model/search.go
index a3fff9977d..ea53cca3de 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -592,7 +592,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
- replaceNodeTokens(n, method, keyword, replacement, r)
+ replaceNodeTokens(n, method, keyword, strings.TrimSpace(replacement), r)
case ast.NodeLinkText:
if !replaceTypes["imgText"] {
return ast.WalkContinue
@@ -673,11 +673,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
if replaceTypes["aHref"] {
if 0 == method {
if strings.Contains(n.TextMarkAHref, keyword) {
- n.TextMarkAHref = strings.ReplaceAll(n.TextMarkAHref, keyword, replacement)
+ n.TextMarkAHref = strings.ReplaceAll(n.TextMarkAHref, keyword, strings.TrimSpace(replacement))
}
} else if 3 == method {
if nil != r && r.MatchString(n.TextMarkAHref) {
- n.TextMarkAHref = r.ReplaceAllString(n.TextMarkAHref, replacement)
+ n.TextMarkAHref = r.ReplaceAllString(n.TextMarkAHref, strings.TrimSpace(replacement))
}
}
}