mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-11 09:44:21 +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
7e8a26f230
commit
53c24fff2b
19 changed files with 62 additions and 70 deletions
|
|
@ -33,11 +33,11 @@ type Export struct {
|
|||
TagCloseMarker string `json:"tagCloseMarker"` // 标签结束标记符,默认是 #
|
||||
FileAnnotationRefMode int `json:"fileAnnotationRefMode"` // 文件标注引用导出模式,0:文件名 - 页码 - 锚文本,1:仅锚文本
|
||||
PandocBin string `json:"pandocBin"` // Pandoc 可执行文件路径
|
||||
PandocParams string `json:"pandocParams"` // Pandoc 额外参数
|
||||
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
|
||||
PDFFooter string `json:"pdfFooter"` // PDF 导出时页脚内容
|
||||
DocxTemplate string `json:"docxTemplate"` // Docx 导出时模板文件路径
|
||||
PDFWatermarkStr string `json:"pdfWatermarkStr"` // PDF 导出时水印文本或水印文件路径
|
||||
PDFWatermarkDesc string `json:"pdfWatermarkDesc"` // PDF 导出时水印位置、大小和样式等
|
||||
ImageWatermarkStr string `json:"imageWatermarkStr"` // 图片导出时水印文本或水印文件路径
|
||||
|
|
|
|||
|
|
@ -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...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue