diff --git a/kernel/model/import.go b/kernel/model/import.go index 51c78876d..e00aac816 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -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