🎨 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

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