Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandoc, Markdown to Doc, how to use variables?

AFAIK, variables can be defined in a YAML external file or inside the Markdown file in a header.

Then they can be used in the document. I have found examples with two different sytaxes:

  • $variable$ will convert variable to math mode, which is great (i.e. I want to keep that behaviour).
  • #{variable} does nothing.

Questions:

  • Is it possible to use variables in the pandoc conversion from markdown to .docx?
  • If so, how?
like image 868
Trylks Avatar asked Jul 09 '16 21:07

Trylks


1 Answers

Pandoc variables can only be used in pandoc templates, not the document itself (there's an open issue about that).

For that you should check out a preprocessor like gpp or use a pandoc filter like pandoc-mustache or this lua-filter.

like image 181
mb21 Avatar answered Oct 19 '22 01:10

mb21