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: New export settings: Include sub-docs, Include related docs https://github.com/siyuan-note/siyuan/issues/13635
Danielcf79a5db32af
diff --git a/app/appearance/langs/ar_SA.json b/app/appearance/langs/ar_SA.jsonindex e33ccff44b..22bd5aa3c4 100644--- a/app/appearance/langs/ar_SA.json+++ b/app/appearance/langs/ar_SA.json@@ -1,7 +1,11 @@{+ "includeSubDocs": "تضمين المستندات الفرعية",+ "includeSubDocsTip": "عند التفعيل، سيتم تضمين جميع المستندات الفرعية للمستند الحالي أثناء التصدير",+ "includeRelatedDocs": "تضمين المستندات المرتبطة",+ "includeRelatedDocsTip": "عند التفعيل، سيتم تضمين المستندات المشار إليها أو المرتبطة بقاعدة البيانات في المستند الحالي أثناء التصدير","removeAssetsID": "إزالة الـ ID من أسماء ملفات الموارد","removeAssetsIDTip": "عند التفعيل سيتم إزالة جزء الـ ID من أسماء ملفات الموارد عند تصدير Markdown",- "clearTempFiles": "Temporäre Dateien bereinigen",+ "clearTempFiles": "مسح الملفات المؤقتة","clearTempFilesTip": "Bereinigen Sie temporäre Dateien, die während der Ausführung der Anwendung erstellt wurden, um Speicherplatz freizugeben","uploadFileTooLarge": "⚠️ الملف الذي تم رفعه [${x}] كبير جدًا [${y}],هل تؤكد المتابعة بالرفع?","recentDocsMaxListCount": "الحد الأقصى لعدد المستندات الحديثة المعروضة",diff --git a/app/appearance/langs/de_DE.json b/app/appearance/langs/de_DE.jsonindex 33cbebd6e3..97a1cb29ec 100644--- a/app/appearance/langs/de_DE.json+++ b/app/appearance/langs/de_DE.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Unterdokumente einbeziehen",+ "includeSubDocsTip": "Wenn aktiviert, werden beim Export alle Unterdokumente des aktuellen Dokuments einbezogen",+ "includeRelatedDocs": "Verwandte Dokumente einbeziehen",+ "includeRelatedDocsTip": "Wenn aktiviert, werden beim Export die im aktuellen Dokument referenzierten oder an Datenbanken gebundenen Dokumente einbezogen","removeAssetsID": "ID aus Asset-Dateinamen entfernen","removeAssetsIDTip": "Wenn aktiviert, wird beim Export nach Markdown der ID-Teil aus den Asset-Dateinamen entfernt","clearTempFiles": "Temporäre Dateien bereinigen",diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 755a2210ae..56d215d10d 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Include sub-documents",+ "includeSubDocsTip": "When enabled, all sub-documents of the current document will be included during export",+ "includeRelatedDocs": "Include related documents",+ "includeRelatedDocsTip": "When enabled, documents referenced or bound by databases in the current document will be included during export","removeAssetsID": "Remove ID from asset file names","removeAssetsIDTip": "When enabled, the ID part will be removed from asset file names when exporting Markdown","clearTempFiles": "Clear temporary files",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex cff4a09325..c15d074913 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Incluir subdocumentos",+ "includeSubDocsTip": "Al activar, se incluirán todos los subdocumentos del documento actual en la exportación",+ "includeRelatedDocs": "Incluir documentos relacionados",+ "includeRelatedDocsTip": "Al activar, se incluirán en la exportación los documentos referenciados o vinculados por base de datos en el documento actual","removeAssetsID": "Eliminar el ID de los nombres de archivo de los recursos","removeAssetsIDTip": "Al habilitar, al exportar a Markdown se eliminará la parte del nombre de archivo de recursos que contiene el ID","clearTempFiles": "Limpiar archivos temporales",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex 64f537d751..272af800f3 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Inclure les sous-documents",+ "includeSubDocsTip": "Si activé, tous les sous-documents du document courant seront inclus lors de l'export",+ "includeRelatedDocs": "Inclure les documents liés",+ "includeRelatedDocsTip": "Si activé, les documents référencés ou liés par la base de données dans le document courant seront inclus lors de l'export","removeAssetsID": "Supprimer l'ID des noms de fichiers des ressources","removeAssetsIDTip": "Une fois activé, lors de l'export en Markdown, la partie ID dans le nom des fichiers de ressources sera supprimée","clearTempFiles": "Effacer les fichiers temporaires",diff --git a/app/appearance/langs/he_IL.json b/app/appearance/langs/he_IL.jsonindex 6cc8102343..e1257b9487 100644--- a/app/appearance/langs/he_IL.json+++ b/app/appearance/langs/he_IL.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "כלול מסמכים משניים",+ "includeSubDocsTip": "בעת הפעלה, בעת ייצוא יכלול את כל תת‑המסמכים של המסמך הנוכחי",+ "includeRelatedDocs": "כלול מסמכים קשורים",+ "includeRelatedDocsTip": "בעת הפעלה, בעת ייצוא יכלול מסמכים שמופנים או מקושרים על‑ידי מסד הנתונים במסמך הנוכחי","removeAssetsID": "הסר את ה‑ID משמות קבצי המשאבים","removeAssetsIDTip": "כאשר מופעל, בעת ייצוא ל‑Markdown יוסר חלק ה‑ID משמות קבצי המשאבים","clearTempFiles": "ניקוי קבצים זמניים",diff --git a/app/appearance/langs/it_IT.json b/app/appearance/langs/it_IT.jsonindex 59be6162ea..3d5b21630a 100644--- a/app/appearance/langs/it_IT.json+++ b/app/appearance/langs/it_IT.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Includi sottodocumenti",+ "includeSubDocsTip": "Se abilitato, durante l'esportazione verranno inclusi tutti i sottodocumenti del documento corrente",+ "includeRelatedDocs": "Includi documenti correlati",+ "includeRelatedDocsTip": "Se abilitato, durante l'esportazione verranno inclusi i documenti riferiti o collegati tramite database nel documento corrente","removeAssetsID": "Rimuovi l'ID dai nomi dei file delle risorse","removeAssetsIDTip": "Se abilitato, durante l'esportazione in Markdown verrà rimossa la parte ID dai nomi dei file delle risorse","clearTempFiles": "Elimina file temporanei",diff --git a/app/appearance/langs/ja_JP.json b/app/appearance/langs/ja_JP.jsonindex dc86f6eaf5..0e6df53398 100644--- a/app/appearance/langs/ja_JP.json+++ b/app/appearance/langs/ja_JP.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "子ドキュメントを含める",+ "includeSubDocsTip": "有効にすると、エクスポート時に現在のドキュメントのすべての子ドキュメントが含まれます",+ "includeRelatedDocs": "関連ドキュメントを含める",+ "includeRelatedDocsTip": "有効にすると、エクスポート時に現在のドキュメントで参照されているドキュメントやデータベースにバインドされたドキュメントを含めます","removeAssetsID": "リソースファイル名から ID を削除","removeAssetsIDTip": "有効にすると Markdown をエクスポートする際にリソースファイル名の ID 部分を削除します","clearTempFiles": "一時ファイルを削除",diff --git a/app/appearance/langs/ko_KR.json b/app/appearance/langs/ko_KR.jsonindex e67ca3813a..6db49a4d7d 100644--- a/app/appearance/langs/ko_KR.json+++ b/app/appearance/langs/ko_KR.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "하위 문서 포함",+ "includeSubDocsTip": "활성화하면 내보낼 때 현재 문서의 모든 하위 문서를 포함합니다",+ "includeRelatedDocs": "관련 문서 포함",+ "includeRelatedDocsTip": "활성화하면 내보낼 때 현재 문서에서 참조되거나 데이터베이스에 바인딩된 문서를 포함합니다","removeAssetsID": "리소스 파일 이름의 ID 제거","removeAssetsIDTip": "활성화하면 Markdown 내보내기 시 리소스 파일 이름의 ID 부분을 제거합니다","clearTempFiles": "임시 파일 정리",diff --git a/app/appearance/langs/pl_PL.json b/app/appearance/langs/pl_PL.jsonindex dcba8a4740..c3ec1e5915 100644--- a/app/appearance/langs/pl_PL.json+++ b/app/appearance/langs/pl_PL.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Uwzględnij poddokumenty",+ "includeSubDocsTip": "Po włączeniu podczas eksportu zostaną uwzględnione wszystkie poddokumenty bieżącego dokumentu",+ "includeRelatedDocs": "Uwzględnij powiązane dokumenty",+ "includeRelatedDocsTip": "Po włączeniu podczas eksportu zostaną uwzględnione dokumenty odwoływane lub powiązane przez bazę danych w bieżącym dokumencie","removeAssetsID": "Usuń ID z nazw plików zasobów","removeAssetsIDTip": "Po włączeniu podczas eksportu do Markdown zostanie usunięta część nazwy pliku zasobu zawierająca ID","clearTempFiles": "Wyczyść pliki tymczasowe",diff --git a/app/appearance/langs/pt_BR.json b/app/appearance/langs/pt_BR.jsonindex a31bdcd10a..e4f07fa546 100644--- a/app/appearance/langs/pt_BR.json+++ b/app/appearance/langs/pt_BR.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Incluir subdocumentos",+ "includeSubDocsTip": "Ao ativar, todos os subdocumentos do documento atual serão incluídos na exportação",+ "includeRelatedDocs": "Incluir documentos relacionados",+ "includeRelatedDocsTip": "Ao ativar, serão incluídos na exportação os documentos referenciados ou vinculados por banco de dados no documento atual","removeAssetsID": "Remover o ID dos nomes dos arquivos de recursos","removeAssetsIDTip": "Ao ativar, ao exportar para Markdown a parte do nome do arquivo de recursos contendo o ID será removida","clearTempFiles": "Limpar arquivos temporários",diff --git a/app/appearance/langs/ru_RU.json b/app/appearance/langs/ru_RU.jsonindex ddd8c08d9d..7b2e203100 100644--- a/app/appearance/langs/ru_RU.json+++ b/app/appearance/langs/ru_RU.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Включать дочерние документы",+ "includeSubDocsTip": "При включении при экспорте будут добавлены все дочерние документы текущего документа",+ "includeRelatedDocs": "Включать связанные документы",+ "includeRelatedDocsTip": "При включении при экспорте будут добавлены документы, на которые ссылается текущий документ или которые связаны через базу данных","removeAssetsID": "Удалить ID из имени файла ресурса","removeAssetsIDTip": "При включении при экспорте в Markdown из имён файлов ресурсов будет удалена часть с ID","clearTempFiles": "Очистить временные файлы",diff --git a/app/appearance/langs/tr_TR.json b/app/appearance/langs/tr_TR.jsonindex d59e71c6de..452c574c71 100644--- a/app/appearance/langs/tr_TR.json+++ b/app/appearance/langs/tr_TR.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "Alt belgeleri dahil et",+ "includeSubDocsTip": "Etkinleştirildiğinde, dışa aktarım sırasında mevcut belgenin tüm alt belgeleri dahil edilir",+ "includeRelatedDocs": "İlişkili belgeleri dahil et",+ "includeRelatedDocsTip": "Etkinleştirildiğinde, dışa aktarım sırasında mevcut belgede referans verilen veya veritabanına bağlı belgeler dahil edilir","removeAssetsID": "Varlık dosya adlarındaki ID'yi kaldır","removeAssetsIDTip": "Etkinleştirildiğinde Markdown dışa aktarılırken varlık dosya adlarındaki ID kısmı kaldırılacaktır","clearTempFiles": "Geçici dosyaları temizle",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex ee5203848e..b43f3431c1 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "包含子文檔",+ "includeSubDocsTip": "啟用後將在匯出時包含當前文檔的所有子文檔",+ "includeRelatedDocs": "包含關聯文檔",+ "includeRelatedDocsTip": "啟用後將在匯出時包含當前文檔中引用、資料庫綁定的文檔","removeAssetsID": "移除資源檔名中的 ID","removeAssetsIDTip": "啟用後在匯出 Markdown 時會移除資源檔名中的 ID 部分","clearTempFiles": "清理臨時檔案",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex a49548d5b9..2e9b6c07cf 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1,4 +1,8 @@{+ "includeSubDocs": "包含子文档",+ "includeSubDocsTip": "启用后将在导出时包含当前文档的所有子文档",+ "includeRelatedDocs": "包含关联文档",+ "includeRelatedDocsTip": "启用后将在导出时包含当前文档中引用、数据库绑定的文档","removeAssetsID": "移除资源文件名中的 ID","removeAssetsIDTip": "启用后在导出 Markdown 时将移除资源文件名中的 ID 部分","clearTempFiles": "清理临时文件",diff --git a/app/src/config/exportConfig.ts b/app/src/config/exportConfig.tsindex 2a46d1e05d..324c4aa420 100644--- a/app/src/config/exportConfig.ts+++ b/app/src/config/exportConfig.ts@@ -55,6 +55,22 @@ export const exportConfig = {<span class="fn__space"></span><input class="b3-switch fn__flex-center" id="inlineMemo" type="checkbox"${window.siyuan.config.export.inlineMemo ? " checked" : ""}/></label>+<label class="fn__flex b3-label">+ <div class="fn__flex-1">+ ${window.siyuan.languages.includeSubDocs}+ <div class="b3-label__text">${window.siyuan.languages.includeSubDocsTip}</div>+ </div>+ <span class="fn__space"></span>+ <input class="b3-switch fn__flex-center" id="includeSubDocs" type="checkbox"${window.siyuan.config.export.includeSubDocs ? " checked" : ""}/>+</label>+<label class="fn__flex b3-label">+ <div class="fn__flex-1">+ ${window.siyuan.languages.includeRelatedDocs}+ <div class="b3-label__text">${window.siyuan.languages.includeRelatedDocsTip}</div>+ </div>+ <span class="fn__space"></span>+ <input class="b3-switch fn__flex-center" id="includeRelatedDocs" type="checkbox"${window.siyuan.config.export.includeRelatedDocs ? " checked" : ""}/>+</label><div class="fn__flex b3-label config__item"><div class="fn__flex-1">${window.siyuan.languages.ref}@@ -218,6 +234,8 @@ export const exportConfig = {removeAssetsID: (exportConfig.element.querySelector("#removeAssetsID") as HTMLInputElement).checked,markdownYFM: (exportConfig.element.querySelector("#markdownYFM") as HTMLInputElement).checked,inlineMemo: (exportConfig.element.querySelector("#inlineMemo") as HTMLInputElement).checked,+ includeSubDocs: (exportConfig.element.querySelector("#includeSubDocs") as HTMLInputElement).checked,+ includeRelatedDocs: (exportConfig.element.querySelector("#includeRelatedDocs") as HTMLInputElement).checked,blockRefMode: parseInt((exportConfig.element.querySelector("#blockRefMode") as HTMLSelectElement).value, 10),blockEmbedMode: parseInt((exportConfig.element.querySelector("#blockEmbedMode") as HTMLSelectElement).value, 10),fileAnnotationRefMode: parseInt((exportConfig.element.querySelector("#fileAnnotationRefMode") as HTMLSelectElement).value, 10),diff --git a/app/src/config/search.ts b/app/src/config/search.tsindex 5665bcf072..94b0bb7ea7 100644--- a/app/src/config/search.ts+++ b/app/src/config/search.ts@@ -56,7 +56,8 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {// 导出getLang(["paragraphBeginningSpace", "md4", "export", "export1", "export2", "export5", "export11","export13", "export14", "export15", "export19", "export20", "ref", "blockEmbed", "export17", "export18",- "export23", "export24", "export25", "export26", "export27", "export28", "export29", "removeAssetsID", "removeAssetsIDTip"]),+ "export23", "export24", "export25", "export26", "export27", "export28", "export29", "removeAssetsID", "removeAssetsIDTip",+ "includeSubDocs", "includeSubDocsTip", "includeRelatedDocs", "includeRelatedDocsTip"]),// 外观getLang(["language", "language1", "appearance", "appearance1", "appearance2", "appearance3", "appearance4",diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.tsindex a9c42e90f2..efd08c075f 100644--- a/app/src/types/config.d.ts+++ b/app/src/types/config.d.ts@@ -578,6 +578,14 @@ declare namespace Config {* Whether to export the inline memo*/inlineMemo: boolean;+ /**+ * Whether to include sub-documents when exporting+ */+ includeSubDocs: boolean;+ /**+ * Whether to include related documents when exporting+ */+ includeRelatedDocs: boolean;/*** Pandoc executable file path*/diff --git a/kernel/conf/export.go b/kernel/conf/export.goindex 962fd3d5b8..aa2afae936 100644--- a/kernel/conf/export.go+++ b/kernel/conf/export.go@@ -38,6 +38,8 @@ type Export struct {RemoveAssetsID bool `json:"removeAssetsID"` // Markdown 导出时是否移除资源文件名 ID 部分 https://github.com/siyuan-note/siyuan/issues/16065MarkdownYFM bool `json:"markdownYFM"` // Markdown 导出时是否添加 YAML Front Matter https://github.com/siyuan-note/siyuan/issues/7727InlineMemo bool `json:"inlineMemo"` // 是否导出行级备注 https://github.com/siyuan-note/siyuan/issues/14605+ IncludeSubDocs bool `json:"includeSubDocs"` // 是否导出子文档 https://github.com/siyuan-note/siyuan/issues/13635+ IncludeRelatedDocs bool `json:"includeRelatedDocs"` // 是否导出关联文档 https://github.com/siyuan-note/siyuan/issues/13635PDFFooter string `json:"pdfFooter"` // PDF 导出时页脚内容PDFWatermarkStr string `json:"pdfWatermarkStr"` // PDF 导出时水印文本或水印文件路径PDFWatermarkDesc string `json:"pdfWatermarkDesc"` // PDF 导出时水印位置、大小和样式等diff --git a/kernel/model/export.go b/kernel/model/export.goindex 07a68e1853..7f77f86d63 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -514,9 +514,12 @@ func ExportSYs(ids []string) (zipPath string) {bts := treenode.GetBlockTrees(ids)for _, bt := range bts {docPaths = append(docPaths, bt.Path)- docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))- for _, docFile := range docFiles {- docPaths = append(docPaths, docFile.path)++ if Conf.Export.IncludeSubDocs {+ docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))+ for _, docFile := range docFiles {+ docPaths = append(docPaths, docFile.path)+ }}}zipPath = exportSYZip(block.BoxID, path.Dir(block.Path), baseFolderName, docPaths)@@ -1705,9 +1708,12 @@ func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath sbts := treenode.GetBlockTrees(ids)for _, bt := range bts {docPaths = append(docPaths, bt.Path)- docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))- for _, docFile := range docFiles {- docPaths = append(docPaths, docFile.path)++ if Conf.Export.IncludeSubDocs {+ docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))+ for _, docFile := range docFiles {+ docPaths = append(docPaths, docFile.path)+ }}}@@ -3617,6 +3623,9 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache}*defBlockIDs = append(*defBlockIDs, defID)+ if !Conf.Export.IncludeRelatedDocs {+ return ast.WalkSkipChildren+ }exportRefTrees(defTree, defBlockIDs, retTrees, treeCache)} else if treenode.IsBlockLink(n) {defID := strings.TrimPrefix(n.TextMarkAHref, "siyuan://blocks/")@@ -3641,6 +3650,9 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache}*defBlockIDs = append(*defBlockIDs, defID)+ if !Conf.Export.IncludeRelatedDocs {+ return ast.WalkSkipChildren+ }exportRefTrees(defTree, defBlockIDs, retTrees, treeCache)} else if ast.NodeAttributeView == n.Type {// 导出数据库所在文档时一并导出绑定块所在文档@@ -3684,6 +3696,9 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache}*defBlockIDs = append(*defBlockIDs, val.BlockID)+ if !Conf.Export.IncludeRelatedDocs {+ return ast.WalkSkipChildren+ }exportRefTrees(defTree, defBlockIDs, retTrees, treeCache)}}