I'm trying to do a markdown to pdf conversion with mdpdf.
Basic pdf creation works.
My problem is to add a footer (or header) with dynamic content, in this case, a date.
Here's my test.md:
# An MDPDF Test
- convert markdown (.md) to PDF
https://github.com/BlueHatbRit/mdpdf/blob/master/examples/footers/md-file.md
Here's my test_footer.html:
<script>
var dt = new Date();
document.getElementById("datetime").innerHTML = dt.toLocaleDateString();
</script>
<center style="font-size: 10px">
<p>FOOTER with locale date: <span id="datetime"></span></p>
</center>
I then call in terminal:
mdpdf /Users/felix/test.md --footer=/Users/felix/test_footer.html
The result is a pdf with the footer text correctly placed, but the actual date in the upper left corner and without localisation.
I saw that mdpdf could use a handlebars (.hbs) file to compile the dynamic content, but have no clue how to do that.
How to get the date into the footer?