Skip to content

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

:bug: Find-replace incorrectly converts tags to text https://github.com/siyuan-note/siyuan/issues/15372

Daniel449b53710490
diff --git a/kernel/model/search.go b/kernel/model/search.go
index c4e228761c..6a86900c2f 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -970,7 +970,7 @@ func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword, escapedKey
if strings.HasPrefix(replacement, "#") && strings.HasSuffix(replacement, "#") {
replacement = strings.TrimPrefix(replacement, "#")
replacement = strings.TrimSuffix(replacement, "#")
- } else {
+ } else if strings.Contains(n.TextMarkTextContent, keyword) || strings.Contains(n.TextMarkTextContent, escapedKey) {
// 将标签转换为纯文本
if "tag" == n.TextMarkType { // 没有其他类型,仅是标签时直接转换