🎨 Built-in Pandoc export .docx template https://github.com/siyuan-note/siyuan/issues/16861

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-18 20:50:41 +08:00
parent 1f02650b38
commit 1012d8b486
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
11 changed files with 44 additions and 4 deletions

View file

@ -101,7 +101,8 @@ func Pandoc(from, to, o, content string) (err error) {
}
var (
PandocBinPath string // Pandoc 可执行文件路径
PandocBinPath string // Pandoc 可执行文件路径
PandocTemplatePath string // Pandoc Docx 模板文件路径
)
func InitPandoc() {
@ -128,6 +129,18 @@ func InitPandoc() {
}
}
PandocTemplatePath = filepath.Join(pandocDir, "pandoc-template.docx")
if !gulu.File.IsExist(PandocTemplatePath) {
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc-template.docx")
if "dev" == Mode || !gulu.File.IsExist(PandocTemplatePath) {
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc/pandoc-template.docx")
}
}
if !gulu.File.IsExist(PandocTemplatePath) {
PandocTemplatePath = ""
logging.LogWarnf("pandoc template file [%s] not found", PandocTemplatePath)
}
defer eventbus.Publish(EvtConfPandocInitialized)
if gulu.OS.IsWindows() {