mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-04 14:22:04 +08:00
🐛 无法替换包含 HTML 转义的代码内容 https://github.com/siyuan-note/siyuan/issues/6476
This commit is contained in:
parent
75925c9e4f
commit
f0088ccf86
@ -207,6 +207,17 @@ func FindReplace(keyword, replacement string, ids []string) (err error) {
|
|||||||
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte(keyword), []byte(replacement))
|
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte(keyword), []byte(replacement))
|
||||||
}
|
}
|
||||||
case ast.NodeTextMark:
|
case ast.NodeTextMark:
|
||||||
|
if n.IsTextMarkType("code") {
|
||||||
|
escapedKey := html.EscapeString(keyword)
|
||||||
|
if strings.Contains(n.TextMarkTextContent, escapedKey) {
|
||||||
|
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, escapedKey, replacement)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if bytes.Contains(n.Tokens, []byte(keyword)) {
|
||||||
|
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if strings.Contains(n.TextMarkTextContent, keyword) {
|
if strings.Contains(n.TextMarkTextContent, keyword) {
|
||||||
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
|
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user