Skip to content

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

:art: Improve exporting markdown https://github.com/siyuan-note/siyuan/issues/15458

Danielaecd230a61ee
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 269864fb97..835f9aaa36 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -2010,7 +2010,11 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
logging.LogErrorf("load tree by block id [%s] failed: %s", id, err)
return
}
- isEmpty = nil == tree.Root.FirstChild.FirstChild
+
+ if ast.NodeParagraph == tree.Root.FirstChild.Type {
+ isEmpty = nil == tree.Root.FirstChild.FirstChild
+ }
+
exportedMd = exportMarkdownContent0(id, tree, "", false, false,
ext, exportRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,