🎨 New export settings: Include sub-docs, Include related docs https://github.com/siyuan-note/siyuan/issues/13635

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-18 22:58:42 +08:00
parent b2f8807dc0
commit cf79a5db32
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
20 changed files with 112 additions and 8 deletions

View file

@ -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": "الحد الأقصى لعدد المستندات الحديثة المعروضة",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -1,4 +1,8 @@
{
"includeSubDocs": "כלול מסמכים משניים",
"includeSubDocsTip": "בעת הפעלה, בעת ייצוא יכלול את כל תת‑המסמכים של המסמך הנוכחי",
"includeRelatedDocs": "כלול מסמכים קשורים",
"includeRelatedDocsTip": "בעת הפעלה, בעת ייצוא יכלול מסמכים שמופנים או מקושרים על‑ידי מסד הנתונים במסמך הנוכחי",
"removeAssetsID": "הסר את הID משמות קבצי המשאבים",
"removeAssetsIDTip": "כאשר מופעל, בעת ייצוא לMarkdown יוסר חלק הID משמות קבצי המשאבים",
"clearTempFiles": "ניקוי קבצים זמניים",

View file

@ -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",

View file

@ -1,4 +1,8 @@
{
"includeSubDocs": "子ドキュメントを含める",
"includeSubDocsTip": "有効にすると、エクスポート時に現在のドキュメントのすべての子ドキュメントが含まれます",
"includeRelatedDocs": "関連ドキュメントを含める",
"includeRelatedDocsTip": "有効にすると、エクスポート時に現在のドキュメントで参照されているドキュメントやデータベースにバインドされたドキュメントを含めます",
"removeAssetsID": "リソースファイル名から ID を削除",
"removeAssetsIDTip": "有効にすると Markdown をエクスポートする際にリソースファイル名の ID 部分を削除します",
"clearTempFiles": "一時ファイルを削除",

View file

@ -1,4 +1,8 @@
{
"includeSubDocs": "하위 문서 포함",
"includeSubDocsTip": "활성화하면 내보낼 때 현재 문서의 모든 하위 문서를 포함합니다",
"includeRelatedDocs": "관련 문서 포함",
"includeRelatedDocsTip": "활성화하면 내보낼 때 현재 문서에서 참조되거나 데이터베이스에 바인딩된 문서를 포함합니다",
"removeAssetsID": "리소스 파일 이름의 ID 제거",
"removeAssetsIDTip": "활성화하면 Markdown 내보내기 시 리소스 파일 이름의 ID 부분을 제거합니다",
"clearTempFiles": "임시 파일 정리",

View file

@ -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",

View file

@ -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",

View file

@ -1,4 +1,8 @@
{
"includeSubDocs": "Включать дочерние документы",
"includeSubDocsTip": "При включении при экспорте будут добавлены все дочерние документы текущего документа",
"includeRelatedDocs": "Включать связанные документы",
"includeRelatedDocsTip": "При включении при экспорте будут добавлены документы, на которые ссылается текущий документ или которые связаны через базу данных",
"removeAssetsID": "Удалить ID из имени файла ресурса",
"removeAssetsIDTip": "При включении при экспорте в Markdown из имён файлов ресурсов будет удалена часть с ID",
"clearTempFiles": "Очистить временные файлы",

View file

@ -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",

View file

@ -1,4 +1,8 @@
{
"includeSubDocs": "包含子文檔",
"includeSubDocsTip": "啟用後將在匯出時包含當前文檔的所有子文檔",
"includeRelatedDocs": "包含關聯文檔",
"includeRelatedDocsTip": "啟用後將在匯出時包含當前文檔中引用、資料庫綁定的文檔",
"removeAssetsID": "移除資源檔名中的 ID",
"removeAssetsIDTip": "啟用後在匯出 Markdown 時會移除資源檔名中的 ID 部分",
"clearTempFiles": "清理臨時檔案",

View file

@ -1,4 +1,8 @@
{
"includeSubDocs": "包含子文档",
"includeSubDocsTip": "启用后将在导出时包含当前文档的所有子文档",
"includeRelatedDocs": "包含关联文档",
"includeRelatedDocsTip": "启用后将在导出时包含当前文档中引用、数据库绑定的文档",
"removeAssetsID": "移除资源文件名中的 ID",
"removeAssetsIDTip": "启用后在导出 Markdown 时将移除资源文件名中的 ID 部分",
"clearTempFiles": "清理临时文件",

View file

@ -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),

View file

@ -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",

View file

@ -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
*/

View file

@ -38,6 +38,8 @@ type Export struct {
RemoveAssetsID bool `json:"removeAssetsID"` // Markdown 导出时是否移除资源文件名 ID 部分 https://github.com/siyuan-note/siyuan/issues/16065
MarkdownYFM bool `json:"markdownYFM"` // Markdown 导出时是否添加 YAML Front Matter https://github.com/siyuan-note/siyuan/issues/7727
InlineMemo 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/13635
PDFFooter string `json:"pdfFooter"` // PDF 导出时页脚内容
PDFWatermarkStr string `json:"pdfWatermarkStr"` // PDF 导出时水印文本或水印文件路径
PDFWatermarkDesc string `json:"pdfWatermarkDesc"` // PDF 导出时水印位置、大小和样式等

View file

@ -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 s
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)
}
}
}
@ -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)
}
}