Trylks Trylks - 4 months ago 37
Markdown Question

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?


Answer

Pandoc variables can only be used in pandoc templates, not the document itself. For that you should check out a preprocessor like gpp or similar.

Comments