Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Workspace built-in Pandoc is no longer initialized after customizing Pandoc path https://github.com/siyuan-note/siyuan/issues/8377

Daniel78f260147148
diff --git a/kernel/util/pandoc.go b/kernel/util/pandoc.go
index c3a13a0cfd..96cf43326e 100644
--- a/kernel/util/pandoc.go
+++ b/kernel/util/pandoc.go
@@ -87,6 +87,24 @@ func initPandoc() {
}
pandocDir := filepath.Join(TempDir, "pandoc")
+
+ if confPath := filepath.Join(ConfDir, "conf.json"); gulu.File.IsExist(confPath) {
+ // Workspace built-in Pandoc is no longer initialized after customizing Pandoc path https://github.com/siyuan-note/siyuan/issues/8377
+ if data, err := os.ReadFile(confPath); nil == err {
+ conf := map[string]interface{}{}
+ if err = gulu.JSON.UnmarshalJSON(data, &conf); nil == err && nil != conf["export"] {
+ export := conf["export"].(map[string]interface{})
+ if customPandocBinPath := export["pandocBin"].(string); !strings.HasPrefix(customPandocBinPath, pandocDir) {
+ if pandocVer := getPandocVer(customPandocBinPath); "" != pandocVer {
+ PandocBinPath = customPandocBinPath
+ logging.LogInfof("custom pandoc [ver=%s, bin=%s]", pandocVer, PandocBinPath)
+ return
+ }
+ }
+ }
+ }
+ }
+
if gulu.OS.IsWindows() {
PandocBinPath = filepath.Join(pandocDir, "bin", "pandoc.exe")
} else if gulu.OS.IsDarwin() || gulu.OS.IsLinux() {