🎨 Double quotes in inline elements are no longer converted to HTML entities when pasting Markdown https://github.com/siyuan-note/siyuan/issues/14503

This commit is contained in:
Daniel 2025-04-03 15:45:57 +08:00
parent 94fe712efd
commit 17de3bc8b1
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 20 additions and 10 deletions

View file

@ -10,7 +10,7 @@ require (
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689
github.com/88250/lute v1.7.7-0.20250403053607-31b58724a8c7
github.com/88250/lute v1.7.7-0.20250403074251-fd2d4ffa705c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
github.com/ConradIrwin/font v0.2.1

View file

@ -14,8 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689 h1:39y5g7vnFAIcXhTN3IXPk7h2xBhC4a9hBTykDhHJqRY=
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689/go.mod h1:c8uVw25vW2W4dhJ/j4iYsX5H1hc19spim266jO5x2hU=
github.com/88250/lute v1.7.7-0.20250403053607-31b58724a8c7 h1:EzmUVWBZdJ2V3vm/HjsG2+JiXCL3OLorT+MIHPB1/FQ=
github.com/88250/lute v1.7.7-0.20250403053607-31b58724a8c7/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/lute v1.7.7-0.20250403074251-fd2d4ffa705c h1:WdGQUp3fmBzlFqalFDO7LdkOXamNZ3p1zZJh604vM2s=
github.com/88250/lute v1.7.7-0.20250403074251-fd2d4ffa705c/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01 h1:AcFe63RXjIh1XtX/dc4Es3U8bYKjlEkvavHd1nFBOHM=
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

View file

@ -667,8 +667,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
} else if n.IsTextMarkType("a") {
if replaceTypes["aText"] {
if 0 == method {
if strings.Contains(n.TextMarkTextContent, keyword) {
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
content := util.UnescapeHTML(n.TextMarkTextContent)
if strings.Contains(content, escapedKey) {
n.TextMarkTextContent = strings.ReplaceAll(content, escapedKey, replacement)
} else if strings.Contains(content, keyword) {
n.TextMarkTextContent = strings.ReplaceAll(content, keyword, replacement)
}
} else if 3 == method {
if nil != r && r.MatchString(n.TextMarkTextContent) {
@ -683,8 +686,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
if replaceTypes["aTitle"] {
if 0 == method {
if strings.Contains(n.TextMarkATitle, keyword) {
n.TextMarkATitle = strings.ReplaceAll(n.TextMarkATitle, keyword, replacement)
title := util.UnescapeHTML(n.TextMarkATitle)
if strings.Contains(title, escapedKey) {
n.TextMarkATitle = strings.ReplaceAll(title, escapedKey, replacement)
} else if strings.Contains(n.TextMarkATitle, keyword) {
n.TextMarkATitle = strings.ReplaceAll(title, keyword, replacement)
}
} else if 3 == method {
if nil != r && r.MatchString(n.TextMarkATitle) {
@ -695,8 +701,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, strings.TrimSpace(replacement))
href := util.UnescapeHTML(n.TextMarkAHref)
if strings.Contains(href, escapedKey) {
n.TextMarkAHref = strings.ReplaceAll(href, escapedKey, util.EscapeHTML(replacement))
} else if strings.Contains(href, keyword) {
n.TextMarkAHref = strings.ReplaceAll(href, keyword, strings.TrimSpace(replacement))
}
} else if 3 == method {
if nil != r && r.MatchString(n.TextMarkAHref) {

View file

@ -257,7 +257,8 @@ func nodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
}
if !strings.HasPrefix(n.TextMarkAHref, "assets/") || includeAssetPath {
buf.WriteString(" " + util.UnescapeHTML(n.TextMarkAHref))
href := util.UnescapeHTML(n.TextMarkAHref)
buf.WriteString(" " + util.UnescapeHTML(href))
}
}
case ast.NodeBackslashContent: