mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-20 15:26:09 +01:00
🎨 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:
parent
be79bdd1ee
commit
6ee0b663e2
2 changed files with 12 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ type Export struct {
|
|||
FileAnnotationRefMode int `json:"fileAnnotationRefMode"` // 文件标注引用导出模式,0:文件名 - 页码 - 锚文本,1:仅锚文本
|
||||
PandocBin string `json:"pandocBin"` // Pandoc 可执行文件路径
|
||||
PandocParams string `json:"pandocParams"` // Pandoc 额外参数
|
||||
DocxTemplate string `json:"docxTemplate"` // Docx 导出时模板文件路径 TODO 已经废弃,计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/16845
|
||||
RemoveAssetsID bool `json:"removeAssetsID"` // Markdown 导出时是否移除资源文件名 ID 部分 https://github.com/siyuan-note/siyuan/issues/16065
|
||||
MarkdownYFM bool `json:"markdownYFM"` // Markdown 导出时是否添加 YAML Front Matter https://github.com/siyuan-note/siyuan/issues/7727
|
||||
InlineMemo bool `json:"inlineMemo"` // 是否导出行级备注 https://github.com/siyuan-note/siyuan/issues/14605
|
||||
|
|
|
|||
|
|
@ -321,6 +321,17 @@ func InitConf() {
|
|||
Conf.Export.PandocBin = util.PandocBinPath
|
||||
}
|
||||
|
||||
docxTemplate := util.RemoveInvalid(Conf.Export.DocxTemplate)
|
||||
if "" != docxTemplate {
|
||||
params := util.RemoveInvalid(Conf.Export.PandocParams)
|
||||
if gulu.File.IsExist(docxTemplate) && !strings.Contains(params, "--reference-doc") {
|
||||
params += " --reference-doc " + docxTemplate
|
||||
Conf.Export.PandocParams = strings.TrimSpace(params)
|
||||
}
|
||||
Conf.Export.DocxTemplate = ""
|
||||
Conf.Save()
|
||||
}
|
||||
|
||||
if nil == Conf.Graph || nil == Conf.Graph.Local || nil == Conf.Graph.Global {
|
||||
Conf.Graph = conf.NewGraph()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue