title: declaring arbitrary variables for pandoc conversion using YAML metadata block
body: <p>I've only recently discovered Pandoc, so I'm still getting to used to it a lot of its features. It looks like an incredibly useful tool and I'm excited to find out some applications for it. I've been consulting the User's Guide, and while there is <a href="https://pandoc.org/MANUAL.html#metadata-blocks" rel="nofollow noreferrer">a section on what I'd like to know</a>, I can't seem to get the desired output. I'm not sure if I'm reading the entry correctly.</p>
  
  <p>Put simply, I have a document in <code>.markdown</code> which acts as a template. From this template, I'd like to produce several other documents (probably <code>.odt</code> and <code>.docx</code>). These documents will be mostly identical, apart from a few pieces of information which I'd like to change. What I'd like to know is, is it possible to change these pieces of information by declaring a variable in the YAML metadata at the top of document.</p>
  
  <p>For example, say I had the following in my <code>.markdown</code> template:</p>
  
  <pre><code>---
  key-one: "value-one"
  key-two: "value-two"
  key-three: "value-three"
  ---
  # DocumentTitle
  ## DocumentSubtitle
  
  This line contains the first value, called $key-one$
  
  This line contains the second value, called $key-two$
  
  This line contains the third value, called $key-three$
  </code></pre>
  
  <p>Is there a way that I can get pandoc to replace the 'placeholders' i.e. <code>key-one</code>, <code>key-two</code>, etc., with the information that is declared in the YAML metadata? This would result in:</p>
  
  <pre><code>This line contains the first value, called value-one
  This line contains the second value, called value-two
  This line contains the third value, called value-three
  </code></pre>
  
  <p>On the User's Guide, it says:</p>
  
  <blockquote>
    <p>If a variable is not set, pandoc will look for the key in the document’s metadata – which can be set using either YAML metadata blocks or with the --metadata option.</p>
  </blockquote>
  
  <p>From what I can find on the User's Guide, it seems that I can't declare values arbitrarily in the metadata. I have found some information about <a href="https://github.com/jgm/pandoc-templates" rel="nofollow noreferrer">Pandoc templates</a>, but I'm not sure how I would have to edit these (or create a custom one) to get the desired output.</p>
  
  <p>Please let me know if anything isn't clear and I will try to be more specific. Thanks in advance.</p>