🎨 查找替换支持替换超链接地址 Fix https://github.com/siyuan-note/siyuan/issues/5750

This commit is contained in:
Liang Ding 2022-08-29 20:18:35 +08:00
parent e59cf202f6
commit bcbbb43059
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -161,7 +161,7 @@ func FindReplace(keyword, replacement string, ids []string) (err error) {
renameRootTitles[n.ID] = strings.ReplaceAll(title, keyword, replacement)
renameRoots = append(renameRoots, n)
}
case ast.NodeText, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeCodeSpanContent, ast.NodeCodeBlockCode, ast.NodeInlineMathContent, ast.NodeMathBlockContent:
case ast.NodeText, ast.NodeLinkDest, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeCodeSpanContent, ast.NodeCodeBlockCode, ast.NodeInlineMathContent, ast.NodeMathBlockContent:
if bytes.Contains(n.Tokens, []byte(keyword)) {
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte(keyword), []byte(replacement))
}