title: Template language for Markdown to Markdown
body: <p>I'm looking for a simple templating engine that takes a YAML snipped as context and works well for reading Markdown plus some tags to produce Markdown. I tried Jekyll's Liquid and it works, except for whitespace which is really important in Markdown.</p>
  
  <p>For example with this input...</p>
  
  <pre><code>---
  samples:
  - name: one
    samplecode: |
      function sample() {
        return 1;
      }
  - name: two
    samplecode: |
      function sample() {
        return 2;
      }
  ---
  
  {% for s in page.samples %}
  - {{s.name}}
  
          {{s.samplecode}}
  
  {% endfor %}
  </code></pre>
  
  <p>the output is:</p>
  
  <pre><code>- one
  
          function sample() {
    return 1;
  }
  
  - two
  
          function sample() {
    return 2;
  }
  </code></pre>
  
  <p>instead of the following which would actually work with Pandoc:</p>
  
  <pre><code>- one
  
          function sample() {
            return 1;
          }
  
  - two
  
          function sample() {
            return 2;
          }
  </code></pre>
  
  <p>This has actually been <a href="https://stackoverflow.com/questions/13646945/indenting-generated-markup-in-jekyll-ruby#comment36154794_13646945">discussed before for Jekyll</a>.</p>
  
  <p>So my question: is there any simple template engine that suits my needs?</p>