htmlxsltmarkdownmultimarkdown

Multimarkdown to custom HTML Template


How do I use MultiMarkdown 4 to take my markdown document and create a full custom HTML document.

As just using multimarkdown file.md > file.html would create the body of the HTML document I could just copy and paste this result into my HTML template, but if I want further control over it, such as ensuring the correct syntax for my code blocks to use prism.js syntax highlighter and other similar things how can this be achieved? The closest I have come is some information on using XSLT, however I can't find any documentation in using this with multimarkdown output.

If someone could point me in the right direction it would be a great help.


Solution

  • A very simple, somewhat hackish way would be to prepare a header.html file containing e.g

    <html>
      <head>
        <title>my page</title>
      </head>
      <body>
    

    and a footer.html containing e.g.

      </body>
    </html>
    

    then, you could do:

    $ cat header.html > file.html
    $ multimarkdown file.md >> file.html
    $ cat footer.html >> file.html
    

    Alternatively, you could use Pandoc instead of multimarkdown, which already includes a templating mechanism, or any other templating solution like mustache or even XSLT if you like that syntax.