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

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-10-09 20:42:17 +08:00
parent d4c9159540
commit 156899cb44
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -2039,6 +2039,8 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
return return
} }
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 { for c := tree.Root.FirstChild; nil != c; c = c.Next {
if ast.NodeParagraph == c.Type { if ast.NodeParagraph == c.Type {
isEmpty = nil == c.FirstChild isEmpty = nil == c.FirstChild
@ -2050,6 +2052,7 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
break break
} }
} }
}
exportedMd = exportMarkdownContent0(id, tree, "", false, false, false, exportedMd = exportMarkdownContent0(id, tree, "", false, false, false,
ext, exportRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, ext, exportRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,