🎨 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 13:39:58 +08:00
parent 4b27f131ca
commit 2068587496
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 18 additions and 16 deletions

File diff suppressed because one or more lines are too long

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.20250403044129-feed500a9010
github.com/88250/lute v1.7.7-0.20250403053607-31b58724a8c7
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.20250403044129-feed500a9010 h1:5t7ULcyGmZlRMvMl62b18LWgc49kqrJBxhegXbXQP6o=
github.com/88250/lute v1.7.7-0.20250403044129-feed500a9010/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
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/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

@ -719,7 +719,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "em")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "em")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
mergeSamePreNext(n)
@ -729,7 +729,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "strong")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "strong")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
mergeSamePreNext(n)
@ -739,7 +739,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "kbd")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "kbd")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
}
@ -748,7 +748,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "mark")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "mark")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
mergeSamePreNext(n)
@ -758,7 +758,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "s")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "s")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
mergeSamePreNext(n)
@ -768,7 +768,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "sub")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "sub")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
}
@ -777,7 +777,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "sup")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "sup")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
}
@ -786,7 +786,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "tag")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "tag")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
}
@ -795,7 +795,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "u")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "u")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
mergeSamePreNext(n)
@ -844,7 +844,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return ast.WalkContinue
}
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "text")
replaceNodeTextMarkTextContent(n, method, keyword, escapedKey, replacement, r, "text")
if "" == n.TextMarkTextContent {
unlinks = append(unlinks, n)
mergeSamePreNext(n)
@ -926,14 +926,16 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
return
}
func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword string, replacement string, r *regexp.Regexp, typ string) {
func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword, escapedKey string, replacement string, r *regexp.Regexp, typ string) {
if 0 == method {
if "tag" == typ {
keyword = strings.TrimPrefix(keyword, "#")
keyword = strings.TrimSuffix(keyword, "#")
}
if strings.Contains(n.TextMarkTextContent, keyword) {
if strings.Contains(n.TextMarkTextContent, escapedKey) {
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, escapedKey, util.EscapeHTML(replacement))
} else if strings.Contains(n.TextMarkTextContent, keyword) {
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
}
} else if 3 == method {