An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 支持聚焦导出 图片/PDF/HTML/Word https://github.com/siyuan-note/siyuan/issues/6607 导出时去掉内容块闪卡样式 https://github.com/siyuan-note/siyuan/issues/7374
Liang Ding3739177f97ee
diff --git a/kernel/model/export.go b/kernel/model/export.goindex a7d6c2dabf..dfe1ddb361 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -366,15 +366,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom stringreturn}- var tree *parse.Tree- luteEngine := NewLute()- tree, _ = filesys.LoadTree(bt.BoxID, bt.Path, luteEngine)- if "d" != bt.Type {- node := treenode.GetNodeInTree(tree, id)- tree = parse.Parse("", []byte(""), luteEngine.ParseOptions)- tree.Root.FirstChild.InsertBefore(node)- }- tree.HPath = bt.HPath+ tree := prepareExportTree(bt)if merge {var mergeErr error@@ -449,6 +441,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string}}+ luteEngine := NewLute()luteEngine.SetFootnotes(true)md := treenode.FormatNode(tree.Root, luteEngine)tree = parse.Parse("", []byte(md), luteEngine.ParseOptions)@@ -485,15 +478,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, doreturn}- var tree *parse.Tree- luteEngine := NewLute()- tree, _ = filesys.LoadTree(bt.BoxID, bt.Path, luteEngine)- if "d" != bt.Type {- node := treenode.GetNodeInTree(tree, id)- tree = parse.Parse("", []byte(""), luteEngine.ParseOptions)- tree.Root.FirstChild.InsertBefore(node)- }- tree.HPath = bt.HPath+ tree := prepareExportTree(bt)if merge {var mergeErr error@@ -558,6 +543,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do}}+ luteEngine := NewLute()if !pdf && "" != savePath { // 导出 HTML 需要复制静态资源srcs := []string{"stage/build/export", "stage/build/fonts", "stage/protyle"}for _, src := range srcs {@@ -612,6 +598,29 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, doreturn}+func prepareExportTree(bt *treenode.BlockTree) (ret *parse.Tree) {+ luteEngine := NewLute()+ ret, _ = filesys.LoadTree(bt.BoxID, bt.Path, luteEngine)+ if "d" != bt.Type {+ node := treenode.GetNodeInTree(ret, bt.ID)+ nodes := []*ast.Node{node}+ if "h" == bt.Type {+ children := treenode.HeadingChildren(node)+ for _, child := range children {+ nodes = append(nodes, child)+ }+ }++ ret = parse.Parse("", []byte(""), luteEngine.ParseOptions)+ first := ret.Root.FirstChild+ for _, node := range nodes {+ first.InsertBefore(node)+ }+ }+ ret.HPath = bt.HPath+ return+}+func processIFrame(tree *parse.Tree) {// 导出 PDF/Word 时 IFrame 块使用超链接 https://github.com/siyuan-note/siyuan/issues/4035var unlinks []*ast.Node@@ -1501,6 +1510,11 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool,}}+ // 导出时去掉内容块闪卡样式 https://github.com/siyuan-note/siyuan/issues/7374+ if n.IsBlock() {+ n.RemoveIALAttr("custom-riff-decks")+ }+switch n.Type {case ast.NodeParagraph:if nil == n.FirstChild {