Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve parsing `<img>` tags when importing https://github.com/siyuan-note/siyuan/issues/15638

Danielc521a0f98520
diff --git a/kernel/model/import.go b/kernel/model/import.go
index 7ead15023a..a61002c92c 100644
--- a/kernel/model/import.go
+++ b/kernel/model/import.go
@@ -1392,11 +1392,18 @@ 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)
- } else {
+ 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)
}