🎨 Add a Ref export mode Anchor hash for notebook Markdown exporting https://github.com/siyuan-note/siyuan/issues/10265

This commit is contained in:
Daniel 2024-01-28 10:35:09 +08:00
parent 0dd90ecef6
commit 9ffa5b7e82
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
8 changed files with 22 additions and 10 deletions

View file

@ -957,7 +957,7 @@
"export27": "Export PDF watermark", "export27": "Export PDF watermark",
"export28": "Watermark text or watermark file path", "export28": "Watermark text or watermark file path",
"export29": "Watermark position, size and style, etc.", "export29": "Watermark position, size and style, etc.",
"export9": "Export image watermark", "export30": "Export image watermark",
"theme11": "Use theme in light mode", "theme11": "Use theme in light mode",
"theme12": "Use theme in dark mode", "theme12": "Use theme in dark mode",
"theme2": "Select the icons used in the user interface", "theme2": "Select the icons used in the user interface",
@ -975,6 +975,7 @@
"export6": "About the handling of anchor text in PDF annotations when exporting", "export6": "About the handling of anchor text in PDF annotations when exporting",
"export7": "File Name - Page Number - Anchor Text", "export7": "File Name - Page Number - Anchor Text",
"export8": "Just anchor text", "export8": "Just anchor text",
"export9": "Anchor hash (only for exporting Notebook)",
"graphConfig2": "Reference Count filter", "graphConfig2": "Reference Count filter",
"selectOpen": "Always Select Opened Doc", "selectOpen": "Always Select Opened Doc",
"selectOpen1": "Select Opened Doc", "selectOpen1": "Select Opened Doc",

View file

@ -957,7 +957,7 @@
"export27": "Exportar marca de agua PDF", "export27": "Exportar marca de agua PDF",
"export28": "Texto de marca de agua o ruta del archivo de marca de agua", "export28": "Texto de marca de agua o ruta del archivo de marca de agua",
"export29": "Posición, tamaño y estilo de la marca de agua, etc.", "export29": "Posición, tamaño y estilo de la marca de agua, etc.",
"export9": "Exportar marca de agua de imagen", "export30": "Exportar marca de agua de imagen",
"theme11": "Usar tema en modo claro", "theme11": "Usar tema en modo claro",
"theme12": "Usar tema en modo oscuro", "theme12": "Usar tema en modo oscuro",
"theme2": "Selecciona los iconos utilizados en la interfaz de usuario", "theme2": "Selecciona los iconos utilizados en la interfaz de usuario",
@ -975,6 +975,7 @@
"export6": "Sobre el manejo del texto ancla en las anotaciones PDF al exportar", "export6": "Sobre el manejo del texto ancla en las anotaciones PDF al exportar",
"export7": "Nombre de archivo - Número de página - Texto ancla", "export7": "Nombre de archivo - Número de página - Texto ancla",
"export8": "Sólo texto ancla", "export8": "Sólo texto ancla",
"export9": "Hash de anclaje (sólo para exportar Notebook)",
"graphConfig2": "Filtro de recuento de referencias", "graphConfig2": "Filtro de recuento de referencias",
"selectOpen": "Seleccionar siempre el documento abierto", "selectOpen": "Seleccionar siempre el documento abierto",
"selectOpen1": "Seleccionar documento abierto", "selectOpen1": "Seleccionar documento abierto",

View file

@ -957,7 +957,7 @@
"export27": "Exporter le filigrane PDF", "export27": "Exporter le filigrane PDF",
"export28": "Texte du filigrane ou chemin du fichier de filigrane", "export28": "Texte du filigrane ou chemin du fichier de filigrane",
"export29": "Position, taille et style du filigrane, etc.", "export29": "Position, taille et style du filigrane, etc.",
"export9": "Exporter le filigrane de l'image", "export30": "Exporter le filigrane de l'image",
"theme11": "Utiliser le thème en mode Clair", "theme11": "Utiliser le thème en mode Clair",
"theme12": "Utiliser le thème en mode sombre", "theme12": "Utiliser le thème en mode sombre",
"theme2": "Sélectionnez les icônes utilisées dans l'interface utilisateur", "theme2": "Sélectionnez les icônes utilisées dans l'interface utilisateur",
@ -975,6 +975,7 @@
"export6": "À propos de la gestion du texte d'ancrage dans les annotations PDF lors de l'exportation", "export6": "À propos de la gestion du texte d'ancrage dans les annotations PDF lors de l'exportation",
"export7": "Nom de fichier - Numéro de page - Texte d'ancrage", "export7": "Nom de fichier - Numéro de page - Texte d'ancrage",
"export8": "Anchor text only", "export8": "Anchor text only",
"export9": "Hash d'ancrage (uniquement pour l'exportation de Notebook)",
"graphConfig2": "Filtre de compte de blocs de référence", "graphConfig2": "Filtre de compte de blocs de référence",
"selectOpen": "Localisez toujours les documents ouverts", "selectOpen": "Localisez toujours les documents ouverts",
"selectOpen1": "Localiser les documents ouverts", "selectOpen1": "Localiser les documents ouverts",

View file

@ -957,7 +957,7 @@
"export27": "導出 PDF 浮水印", "export27": "導出 PDF 浮水印",
"export28": "浮水印文字或浮水印檔案路徑", "export28": "浮水印文字或浮水印檔案路徑",
"export29": "浮水印位置、大小和樣式等", "export29": "浮水印位置、大小和樣式等",
"export9": "匯出圖片浮水印", "export30": "匯出圖片浮水印",
"theme11": "淺色模式下使用主題", "theme11": "淺色模式下使用主題",
"theme12": "深色模式下使用主題", "theme12": "深色模式下使用主題",
"theme2": "選擇外觀使用的圖示", "theme2": "選擇外觀使用的圖示",
@ -975,6 +975,7 @@
"export6": "導出時關於 PDF 標註引出處錨文字的處理方式", "export6": "導出時關於 PDF 標註引出處錨文字的處理方式",
"export7": "文件名 - 頁碼 - 錨文字", "export7": "文件名 - 頁碼 - 錨文字",
"export8": "僅錨文字", "export8": "僅錨文字",
"export9": "錨點哈希(僅支援導出筆記本)",
"graphConfig2": "引用塊次數過濾", "graphConfig2": "引用塊次數過濾",
"selectOpen": "定位打開的文檔", "selectOpen": "定位打開的文檔",
"selectOpen1": "定位打開的文檔", "selectOpen1": "定位打開的文檔",

View file

@ -957,7 +957,7 @@
"export27": "导出 PDF 水印", "export27": "导出 PDF 水印",
"export28": "水印文本或水印文件路径", "export28": "水印文本或水印文件路径",
"export29": "水印位置、大小和样式等", "export29": "水印位置、大小和样式等",
"export9": "导出图片水印", "export30": "导出图片水印",
"theme11": "明亮模式下使用主题", "theme11": "明亮模式下使用主题",
"theme12": "暗黑模式下使用主题", "theme12": "暗黑模式下使用主题",
"theme2": "选择外观使用的图标", "theme2": "选择外观使用的图标",
@ -975,6 +975,7 @@
"export6": "导出时关于 PDF 标注引出处锚文本的处理方式", "export6": "导出时关于 PDF 标注引出处锚文本的处理方式",
"export7": "文件名 - 页码 - 锚文本", "export7": "文件名 - 页码 - 锚文本",
"export8": "仅锚文本", "export8": "仅锚文本",
"export9": "锚点哈希(仅支持导出笔记本)",
"graphConfig2": "引用块次数过滤", "graphConfig2": "引用块次数过滤",
"selectOpen": "始终定位打开的文档", "selectOpen": "始终定位打开的文档",
"selectOpen1": "定位打开的文档", "selectOpen1": "定位打开的文档",

View file

@ -46,6 +46,7 @@ export const exportConfig = {
<option value="2" ${window.siyuan.config.export.blockRefMode === 2 ? "selected" : ""}>${window.siyuan.languages.export2}</option> <option value="2" ${window.siyuan.config.export.blockRefMode === 2 ? "selected" : ""}>${window.siyuan.languages.export2}</option>
<option value="3" ${window.siyuan.config.export.blockRefMode === 3 ? "selected" : ""}>${window.siyuan.languages.export3}</option> <option value="3" ${window.siyuan.config.export.blockRefMode === 3 ? "selected" : ""}>${window.siyuan.languages.export3}</option>
<option value="4" ${window.siyuan.config.export.blockRefMode === 4 ? "selected" : ""}>${window.siyuan.languages.export4}</option> <option value="4" ${window.siyuan.config.export.blockRefMode === 4 ? "selected" : ""}>${window.siyuan.languages.export4}</option>
<option value="5" ${window.siyuan.config.export.blockRefMode === 5 ? "selected" : ""}>${window.siyuan.languages.export9}</option>
</select> </select>
</div> </div>
<div class="fn__flex b3-label config__item"> <div class="fn__flex b3-label config__item">
@ -88,7 +89,7 @@ export const exportConfig = {
<textarea class="b3-text-field fn__block" id="pdfWatermarkDesc"></textarea> <textarea class="b3-text-field fn__block" id="pdfWatermarkDesc"></textarea>
</div> </div>
<div class="b3-label config__item"> <div class="b3-label config__item">
${window.siyuan.languages.export9} ${window.siyuan.languages.export30}
<div class="b3-label__text">${window.siyuan.languages.export28}</div> <div class="b3-label__text">${window.siyuan.languages.export28}</div>
<div class="fn__hr"></div> <div class="fn__hr"></div>
<input class="b3-text-field fn__block" id="imageWatermarkStr"> <input class="b3-text-field fn__block" id="imageWatermarkStr">

View file

@ -42,7 +42,7 @@ export const exportImage = (id: string) => {
<input id="keepFold" class="b3-switch fn__flex-center" type="checkbox" ${window.siyuan.storage[Constants.LOCAL_EXPORTIMG].keepFold ? "checked" : ""}> <input id="keepFold" class="b3-switch fn__flex-center" type="checkbox" ${window.siyuan.storage[Constants.LOCAL_EXPORTIMG].keepFold ? "checked" : ""}>
</label> </label>
<label class="fn__flex" style="margin-left: 24px"> <label class="fn__flex" style="margin-left: 24px">
${window.siyuan.languages.export9} ${window.siyuan.languages.export30}
<span class="fn__space"></span> <span class="fn__space"></span>
<input id="watermark" class="b3-switch fn__flex-center" type="checkbox" ${window.siyuan.storage[Constants.LOCAL_EXPORTIMG].watermark ? "checked" : ""}> <input id="watermark" class="b3-switch fn__flex-center" type="checkbox" ${window.siyuan.storage[Constants.LOCAL_EXPORTIMG].watermark ? "checked" : ""}>
</label> </label>

View file

@ -1338,7 +1338,7 @@ func ExportPandocConvertZip(id, pandocTo, ext string) (name, zipPath string) {
docPaths = append(docPaths, docFile.path) docPaths = append(docPaths, docFile.path)
} }
zipPath = exportPandocConvertZip(false, boxID, baseFolderName, docPaths, Conf.Export.BlockRefMode, "gfm+footnotes+hard_line_breaks", pandocTo, ext) zipPath = exportPandocConvertZip(false, boxID, baseFolderName, docPaths, "gfm+footnotes+hard_line_breaks", pandocTo, ext)
name = strings.TrimSuffix(filepath.Base(block.Path), ".sy") name = strings.TrimSuffix(filepath.Base(block.Path), ".sy")
return return
} }
@ -1366,7 +1366,7 @@ func BatchExportMarkdown(boxID, folderPath string) (zipPath string) {
for _, docFile := range docFiles { for _, docFile := range docFiles {
docPaths = append(docPaths, docFile.path) docPaths = append(docPaths, docFile.path)
} }
zipPath = exportPandocConvertZip(true, boxID, baseFolderName, docPaths, Conf.Export.BlockRefMode, "", "", ".md") zipPath = exportPandocConvertZip(true, boxID, baseFolderName, docPaths, "", "", ".md")
return return
} }
@ -2583,7 +2583,7 @@ func processFileAnnotationRef(refID string, n *ast.Node, fileAnnotationRefMode i
return ast.WalkSkipChildren return ast.WalkSkipChildren
} }
func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, docPaths []string, exportRefMode int, func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, docPaths []string,
pandocFrom, pandocTo, ext string) (zipPath string) { pandocFrom, pandocTo, ext string) (zipPath string) {
dir, name := path.Split(baseFolderName) dir, name := path.Split(baseFolderName)
name = util.FilterFileName(name) name = util.FilterFileName(name)
@ -2602,6 +2602,12 @@ func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, d
return return
} }
exportRefMode := Conf.Export.BlockRefMode
if !exportNotebook && 5 == exportRefMode {
// 非笔记本导出不支持锚点哈希,将其切换为锚文本块链
exportRefMode = 2
}
var defBlockIDs []string var defBlockIDs []string
if exportNotebook && 5 == exportRefMode { if exportNotebook && 5 == exportRefMode {
// Add a Ref export mode `Anchor hash` for notebook Markdown exporting https://github.com/siyuan-note/siyuan/issues/10265 // Add a Ref export mode `Anchor hash` for notebook Markdown exporting https://github.com/siyuan-note/siyuan/issues/10265