An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: 列表项第一个子块为空时导出渲染错误 Fix https://github.com/siyuan-note/siyuan/issues/5806
Liang Ding9268a1564f62
diff --git a/kernel/model/export.go b/kernel/model/export.goindex ae0aa375eb..f815af8e42 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -1270,6 +1270,7 @@ func exportTree(tree *parse.Tree, wysiwyg bool) (ret *parse.Tree) {}unlinks = nil+ var emptyParagraphs []*ast.Nodeast.Walk(ret.Root, func(n *ast.Node, entering bool) ast.WalkStatus {if !entering {return ast.WalkContinue@@ -1279,6 +1280,13 @@ func exportTree(tree *parse.Tree, wysiwyg bool) (ret *parse.Tree) {n.RemoveIALAttr("fold")n.RemoveIALAttr("heading-fold")+ if ast.NodeParagraph == n.Type {+ if nil == n.FirstChild {+ // 空的段落块需要补全文本展位,否则后续格式化后再解析树会语义不一致 https://github.com/siyuan-note/siyuan/issues/5806+ emptyParagraphs = append(emptyParagraphs, n)+ }+ }+if ast.NodeWidget == n.Type {// 挂件块导出 https://github.com/siyuan-note/siyuan/issues/3834exportMdVal := n.IALAttr("data-export-md")@@ -1309,6 +1317,9 @@ func exportTree(tree *parse.Tree, wysiwyg bool) (ret *parse.Tree) {for _, n := range unlinks {n.Unlink()}+ for _, emptyParagraph := range emptyParagraphs {+ emptyParagraph.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(parse.Zwj)})+ }return ret}