From df5f5272c1fd4635ba97f7181902c802288bc0b8 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 13 Oct 2022 22:25:31 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=A2=9E=E5=8A=A0=E6=8C=82=E4=BB=B6?= =?UTF-8?q?=E5=9D=97=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=87=BA=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=20`data-export-html`=20Fix=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/6188?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/export.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/model/export.go b/kernel/model/export.go index 594580ae4..c8e789155 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1259,7 +1259,18 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool) (re } if ast.NodeWidget == n.Type { - // 挂件块导出 https://github.com/siyuan-note/siyuan/issues/3834 + // 挂件块导出 https://github.com/siyuan-note/siyuan/issues/3834 https://github.com/siyuan-note/siyuan/issues/6188 + + if wysiwyg { + exportHtmlVal := n.IALAttr("data-export-html") + if "" != exportHtmlVal { + htmlBlock := &ast.Node{Type: ast.NodeHTMLBlock, Tokens: []byte(exportHtmlVal)} + n.InsertBefore(htmlBlock) + unlinks = append(unlinks, n) + return ast.WalkContinue + } + } + exportMdVal := n.IALAttr("data-export-md") exportMdVal = html.UnescapeString(exportMdVal) // 导出 `data-export-md` 时未解析代码块与行内代码内的转义字符 https://github.com/siyuan-note/siyuan/issues/4180 if "" != exportMdVal {