An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Preserve escaped elements in replacement text https://github.com/siyuan-note/siyuan/issues/15256
Daniel401d2928cab8
diff --git a/kernel/model/search.go b/kernel/model/search.goindex a097703223..c8e2115c61 100644--- a/kernel/model/search.go+++ b/kernel/model/search.go@@ -1421,7 +1421,7 @@ func parseReplaceText(replacement string, luteEngine *lute.Lute) (ret []*ast.Nodif nil == tree.Root.FirstChild {return nil, "" == replacement}- parse.NestedInlines2FlattedSpans(tree, false)+ parse.NestedInlines2FlattedSpansHybrid(tree, false)for child := tree.Root.FirstChild.FirstChild; nil != child; {next := child.Nextchild.Unlink()diff --git a/kernel/model/search_test.go b/kernel/model/search_test.goindex b72373af58..154b9a9d65 100644--- a/kernel/model/search_test.go+++ b/kernel/model/search_test.go@@ -629,6 +629,21 @@ func TestReplaceTextAcrossBackslashes(t *testing.T) {expected: " item",changed: true,},+ {+ name: "preserve backslash in replacement",+ nodes: func() []*ast.Node {+ return []*ast.Node{+ replaceTextTestText("123"),+ replaceTextTestBackslash(".", ast.NodeBackslashContent),+ replaceTextTestText(" 123"),+ }+ },+ keyword: "123. 123",+ replacement: `1234\. 123`,+ expected: "1234. 123",+ changed: true,+ backslashes: []string{"."},+ },{name: "preserve unmatched backslash",nodes: func() []*ast.Node {