mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🎨 Improve parsing <img> tags when importing https://github.com/siyuan-note/siyuan/issues/15638
This commit is contained in:
parent
cd7734ba91
commit
c521a0f985
1 changed files with 11 additions and 4 deletions
|
|
@ -1392,12 +1392,19 @@ func htmlBlock2Inline(tree *parse.Tree) {
|
|||
img.InsertAfter(ial)
|
||||
}
|
||||
|
||||
if nil != n.Parent && ast.NodeText == n.Type {
|
||||
// 行级 HTML 会被解析为文本,所以这里要在父级段落前面插入,避免形成段落嵌套 https://github.com/siyuan-note/siyuan/issues/13080
|
||||
n.Parent.InsertBefore(p)
|
||||
if ast.NodeHTMLBlock == n.Type {
|
||||
n.InsertBefore(p)
|
||||
} else if ast.NodeText == n.Type {
|
||||
if nil != n.Parent {
|
||||
if n.Parent.IsContainerBlock() {
|
||||
n.InsertBefore(p)
|
||||
} else {
|
||||
n.InsertBefore(img)
|
||||
}
|
||||
} else {
|
||||
n.InsertBefore(p)
|
||||
}
|
||||
}
|
||||
unlinks = append(unlinks, n)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue