🧑‍💻 Improve kernel API exportMdContent https://github.com/siyuan-note/siyuan/issues/14032

This commit is contained in:
Daniel 2025-02-18 15:55:25 +08:00
parent e9c7ba082e
commit 615b749d6a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 6 additions and 8 deletions

View file

@ -1490,11 +1490,6 @@ func ExportNotebookMarkdown(boxID string) (zipPath string) {
func yfm(docIAL map[string]string) string {
// 导出 Markdown 文件时开头附上一些元数据 https://github.com/siyuan-note/siyuan/issues/6880
if !Conf.Export.MarkdownYFM {
// 导出 Markdown 时在文档头添加 YFM 开关 https://github.com/siyuan-note/siyuan/issues/7727
return ""
}
buf := bytes.Buffer{}
buf.WriteString("---\n")
var title, created, updated, tags string
@ -1959,7 +1954,10 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
Conf.Export.AddTitle, defBlockIDs, singleFile, treeCache)
docIAL := parse.IAL2Map(tree.Root.KramdownIAL)
exportedMd = yfm(docIAL) + exportedMd
if Conf.Export.MarkdownYFM {
// 导出 Markdown 时在文档头添加 YFM 开关 https://github.com/siyuan-note/siyuan/issues/7727
exportedMd = yfm(docIAL) + exportedMd
}
return
}