Pandoc、Markdown 转 Doc,如何使用变量?
Pandoc, Markdown to Doc, how to use variables?
AFAIK,变量可以在 YAML 外部文件中定义,也可以在 header.
中的 Markdown 文件中定义
然后就可以在文档中使用了。我找到了具有两种不同语法的示例:
$variable$
会将变量转换为数学模式,这很棒(即我想保持这种行为)。
#{variable}
什么都不做。
问题:
- 是否可以在从 markdown 到 .docx 的 pandoc 转换中使用变量?
- 如果是,怎么做?
Pandoc 变量只能在 pandoc templates, not the document itself (there's an open issue about that).
中使用
为此,您应该查看 preprocessor like gpp
or use a pandoc filter like pandoc-mustache or this lua-filter。
AFAIK,变量可以在 YAML 外部文件中定义,也可以在 header.
中的 Markdown 文件中定义然后就可以在文档中使用了。我找到了具有两种不同语法的示例:
$variable$
会将变量转换为数学模式,这很棒(即我想保持这种行为)。#{variable}
什么都不做。
问题:
- 是否可以在从 markdown 到 .docx 的 pandoc 转换中使用变量?
- 如果是,怎么做?
Pandoc 变量只能在 pandoc templates, not the document itself (there's an open issue about that).
中使用为此,您应该查看 preprocessor like gpp
or use a pandoc filter like pandoc-mustache or this lua-filter。