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: Improve exporting block ref https://github.com/siyuan-note/siyuan/issues/13283
Daniel4aedef073db8
diff --git a/kernel/go.mod b/kernel/go.modindex 3858b0b3bb..214309e8eb 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -10,7 +10,7 @@ require (github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d- github.com/88250/lute v1.7.7-0.20241201152142-83b4fa17beb1+ github.com/88250/lute v1.7.7-0.20241202034509-ac239093024egithub.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4github.com/ConradIrwin/font v0.0.0-20240627033111-8567075b2bfediff --git a/kernel/go.sum b/kernel/go.sumindex 951f1b2ba7..c3c6b5b771 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -14,8 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceTgithub.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d h1:dexFyk3UkR4c2xpyrC4Zk4L28xFbfLYAeowIW/7QYEA=github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=-github.com/88250/lute v1.7.7-0.20241201152142-83b4fa17beb1 h1:Aq2DO8bWUysxUSxznIGUqUYNPc4mAKKdFenbwi7XmQ4=-github.com/88250/lute v1.7.7-0.20241201152142-83b4fa17beb1/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=+github.com/88250/lute v1.7.7-0.20241202034509-ac239093024e h1:1zdZ4qBtvQZSBEa8TfFBNP3I8EtsfvYeRcfue0itHEI=+github.com/88250/lute v1.7.7-0.20241202034509-ac239093024e/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01 h1:AcFe63RXjIh1XtX/dc4Es3U8bYKjlEkvavHd1nFBOHM=github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=diff --git a/kernel/model/export.go b/kernel/model/export.goindex 4d69dfc8a7..cf444f4785 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -565,9 +565,15 @@ func ExportResources(resourcePaths []string, mainName string) (exportFilePath st}func Preview(id string) (retStdHTML string) {+ blockRefMode := Conf.Export.BlockRefMode+ if 5 == blockRefMode {+ // 如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283+ blockRefMode = 4+ }+tree, _ := LoadTreeByBlockID(id)tree = exportTree(tree, false, false, true,- Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,+ blockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,Conf.Export.AddTitle)@@ -671,7 +677,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom stringblockRefMode := Conf.Export.BlockRefModeif docx {if 5 == blockRefMode {- // 导出 HTML/Word 时如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283+ // 如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283blockRefMode = 4}}@@ -755,14 +761,13 @@ 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)if docx {processIFrame(tree)}+ luteEngine := NewLute()+ luteEngine.SetFootnotes(true)+// 自定义表情图片地址去掉开头的 /ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {if !entering {@@ -827,7 +832,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do}if 5 == blockRefMode {- // 导出 PDF 时如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283+ // 如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283blockRefMode = 4}}@@ -864,7 +869,6 @@ 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 {@@ -916,6 +920,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, doprocessIFrame(tree)}+ luteEngine := NewLute()luteEngine.SetFootnotes(true)luteEngine.RenderOptions.ProtyleContenteditable = falseluteEngine.SetProtyleMarkNetImg(false)