title: Compile multiple files into one with title blocks
body: <p>I'd like to know how to compile multiple pandoc files into one output document, <strong>where each input file has a title block</strong>.</p>
  
  <p>E.g. suppose I have two files:</p>
  
  <p><code>ch1.md</code>:</p>
  
  <pre><code>% Chapter 1
  % John Doe
  % 1 Jan 2014
  Here is chapter 1.
  </code></pre>
  
  <p><code>ch2.md</code>:</p>
  
  <pre><code>% Chapter 2
  % Jane Smith
  % 3 Jan 2014
  Here is chapter 2.
  </code></pre>
  
  <p>Typically with multiple input files you can compile them by providing them to pandoc:</p>
  
  <pre><code>pandoc ch1.md ch2.md --standalone -o output.html
  </code></pre>
  
  <p>However pandoc concatenates the input files before compiling, meaning only the <em>first</em> title block (from <code>ch1.md</code>) is styled appropriately.
  I would like <em>each</em> title block to be styled appropriately (e.g. in html, the first line of the title block is styled with <code>&lt;h1 class="title"&gt;</code>, the second <code>&lt;h2 class="author"&gt;</code> and so on).</p>
  
  <p>(Note: I have also tried compiling each chapter as standalone separately, then concatenating these together using <code>pandoc</code>. This removes the title styling for chapters after 1, though keeps styling for the authors/date).</p>
  
  <p><strong>Why?</strong> I can:</p>
  
  <ul>
  <li>compile each chapter in its own separate document and the author/title/date is marked up appropriately</li>
  <li>compile the entire document together and author/title/date is marked up appropriately for each chapter (can use the <code>--chapters</code> option)</li>
  </ul>
  
  <p>I could just specify the heading with '#' (h1), author with '##' (h2), and date with '###' (h3) in each chapter file directly but this means pandoc doesn't "know" what the title/heading/date of my document are, so (e.g.) if I compile to latex it won't use the <code>\date{}</code> or <code>\author{}</code> tags appropriately.</p>