🎨 Repeat the escaped content of the image title https://github.com/siyuan-note/siyuan/issues/11681

This commit is contained in:
Daniel 2024-06-11 11:15:23 +08:00
parent 519b004f81
commit 334f693d5d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 11 additions and 6 deletions

View file

@ -429,11 +429,11 @@ func (box *Box) moveTrees0(files []*FileInfo) {
func parseKTree(kramdown []byte) (ret *parse.Tree) {
luteEngine := NewLute()
ret = parse.Parse("", kramdown, luteEngine.ParseOptions)
genTreeID(ret)
normalizeTree(ret)
return
}
func genTreeID(tree *parse.Tree) {
func normalizeTree(tree *parse.Tree) {
if nil == tree.Root.FirstChild {
tree.Root.AppendChild(treenode.NewParagraph())
}
@ -494,6 +494,11 @@ func genTreeID(tree *parse.Tree) {
n.InsertBefore(n.FirstChild)
}
if ast.NodeLinkTitle == n.Type {
// 避免重复转义图片标题内容 Repeat the escaped content of the image title https://github.com/siyuan-note/siyuan/issues/11681
n.Tokens = html.UnescapeBytes(n.Tokens)
}
return ast.WalkContinue
})
tree.Root.KramdownIAL = parse.Tokens2IAL(tree.Root.LastChild.Tokens)