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: Add `data-doc-type` and attribute when exporting image and PDF https://github.com/siyuan-note/siyuan/issues/9497
Danieldbd829a4a043
diff --git a/kernel/api/export.go b/kernel/api/export.goindex 536f0806fe..651efd3d4a 100644--- a/kernel/api/export.go+++ b/kernel/api/export.go@@ -26,6 +26,7 @@ import ("time""github.com/88250/gulu"+ "github.com/88250/lute/parse""github.com/gin-gonic/gin""github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/model"@@ -462,14 +463,23 @@ func exportPreviewHTML(c *gin.Context) {if nil != arg["image"] {image = arg["image"].(bool)}- name, content := model.ExportHTML(id, "", true, image, keepFold, merge)+ name, content, node := model.ExportHTML(id, "", true, image, keepFold, merge)// 导出 PDF 预览时点击块引转换后的脚注跳转不正确 https://github.com/siyuan-note/siyuan/issues/5894content = strings.ReplaceAll(content, "http://"+util.LocalHost+":"+util.ServerPort+"/#", "#")+ attrs := map[string]string{}+ var typ string+ if nil != node {+ attrs = parse.IAL2Map(node.KramdownIAL)+ typ = node.Type.String()+ }+ret.Data = map[string]interface{}{"id": id,"name": name,"content": content,+ "attrs": attrs,+ "type": typ,}}@@ -493,7 +503,7 @@ func exportHTML(c *gin.Context) {if nil != arg["merge"] {merge = arg["merge"].(bool)}- name, content := model.ExportHTML(id, savePath, pdf, false, keepFold, merge)+ name, content, _ := model.ExportHTML(id, savePath, pdf, false, keepFold, merge)ret.Data = map[string]interface{}{"id": id,"name": name,diff --git a/kernel/model/export.go b/kernel/model/export.goindex bcecb39908..863f264260 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -585,7 +585,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom stringreturn}-func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, dom string) {+func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, dom string, node *ast.Node) {savePath = strings.TrimSpace(savePath)bt := treenode.GetBlockTree(id)@@ -594,6 +594,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do}tree := prepareExportTree(bt)+ node = treenode.GetNodeInTree(tree, id)if merge {var mergeErr error