🎨 Supports setting Pandoc parameters for export https://github.com/siyuan-note/siyuan/issues/16845

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-16 22:58:46 +08:00
parent 7e8a26f230
commit 53c24fff2b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
19 changed files with 62 additions and 70 deletions

View file

@ -721,17 +721,9 @@ func ExportDocx(id, savePath string, removeAssets, merge bool) (fullPath string,
"-o", tmpDocxPath,
}
// Pandoc template for exporting docx https://github.com/siyuan-note/siyuan/issues/8740
docxTemplate := util.RemoveInvalid(Conf.Export.DocxTemplate)
docxTemplate = strings.TrimSpace(docxTemplate)
if "" != docxTemplate {
if !gulu.File.IsExist(docxTemplate) {
logging.LogErrorf("docx template [%s] not found", docxTemplate)
err = errors.New(fmt.Sprintf(Conf.Language(197), docxTemplate))
return
}
args = append(args, "--reference-doc", docxTemplate)
params := util.RemoveInvalid(Conf.Export.PandocParams)
if "" != params {
args = append(args, strings.Split(params, " ")...)
}
pandoc := exec.Command(Conf.Export.PandocBin, args...)