From f552dc44df6437611cd284470113e55c2fa099cb Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 23 Mar 2023 15:08:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:art:=20=E5=AF=BC=E5=87=BA=20Markdown=20?= =?UTF-8?q?=E6=97=B6=E5=9C=A8=E6=96=87=E6=A1=A3=E5=A4=B4=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20YFM=20=E5=BC=80=E5=85=B3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/7727?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/export.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/model/export.go b/kernel/model/export.go index f68a08dbe..07dc4dded 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1077,7 +1077,6 @@ func exportMarkdownZip(boxID, baseFolderName string, docPaths []string) (zipPath id := docIAL["id"] hPath, md := exportMarkdownContent(id) - md = yfm(docIAL) + md dir, name = path.Split(hPath) dir = util.FilterFilePath(dir) // 导出文档时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/4590 name = util.FilterFileName(name) @@ -1441,6 +1440,8 @@ func exportMarkdownContent(id string) (hPath, exportedMd string) { Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker, Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight, Conf.Export.AddTitle) + docIAL := parse.IAL2Map(tree.Root.KramdownIAL) + exportedMd = yfm(docIAL) + exportedMd return } From 7e62a43660ac54bb08aaa2a9d06e9ee42670a822 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 23 Mar 2023 15:23:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:art:=20=E6=8C=82=E4=BB=B6=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=B1=9E=E6=80=A7=20`data-export-md`=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20YFM=20https://github.com/siyuan-note/siyuan/issues/?= =?UTF-8?q?7752?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/export.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/model/export.go b/kernel/model/export.go index 07dc4dded..3a4c17b5a 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1785,6 +1785,8 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool, exportMdVal := n.IALAttr("data-export-md") exportMdVal = html.UnescapeString(exportMdVal) // 导出 `data-export-md` 时未解析代码块与行内代码内的转义字符 https://github.com/siyuan-note/siyuan/issues/4180 if "" != exportMdVal { + luteEngine0 := util.NewLute() + luteEngine0.SetYamlFrontMatter(true) // 挂件导出属性 `data-export-md` 支持 YFM https://github.com/siyuan-note/siyuan/issues/7752 exportMdTree := parse.Parse("", []byte(exportMdVal), luteEngine.ParseOptions) var insertNodes []*ast.Node for c := exportMdTree.Root.FirstChild; nil != c; c = c.Next {