Skip to content

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

:art: Improve export of empty documents with subdocuments https://github.com/siyuan-note/siyuan/issues/16040

Daniel156899cb44a8
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 34ccac57ad..b734689a5a 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -2039,15 +2039,18 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
return
}
- for c := tree.Root.FirstChild; nil != c; c = c.Next {
- if ast.NodeParagraph == c.Type {
- isEmpty = nil == c.FirstChild
- if !isEmpty {
+ refCount := sql.QueryRootChildrenRefCount(tree.ID)
+ if !Conf.Export.MarkdownYFM && 5 > len(tree.Root.KramdownIAL) && 1 > len(refCount) {
+ for c := tree.Root.FirstChild; nil != c; c = c.Next {
+ if ast.NodeParagraph == c.Type {
+ isEmpty = nil == c.FirstChild
+ if !isEmpty {
+ break
+ }
+ } else {
+ isEmpty = false
break
}
- } else {
- isEmpty = false
- break
}
}