Skip to content

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

:art: 增加挂件块数据导出属性 `data-export-html` Fix https://github.com/siyuan-note/siyuan/issues/6188

Liang Dingdf5f5272c1fd
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 594580ae41..c8e789155b 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 {