This commit is contained in:
Daniel 2025-08-20 19:02:55 +08:00
parent 6e6522d56a
commit aabb85d895
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1374,6 +1374,15 @@ func htmlBlock2Inline(tree *parse.Tree) {
img.AppendChild(&ast.Node{Type: ast.NodeLinkTitle})
}
img.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
if width := domAttrValue(htmlImg, "width"); "" != width {
if util2.IsDigit(width) {
width += "px"
}
style := "width: " + width + ";"
ial := &ast.Node{Type: ast.NodeKramdownSpanIAL, Tokens: parse.IAL2Tokens([][]string{{"style", style}})}
img.SetIALAttr("style", style)
img.InsertAfter(ial)
}
if nil != n.Parent && ast.NodeText == n.Type {
// 行级 HTML 会被解析为文本,所以这里要在父级段落前面插入,避免形成段落嵌套 https://github.com/siyuan-note/siyuan/issues/13080