mdpdf 1.3 release - headers footers and more
This week version 1.3 of mdpdf has been released, I thought I'd take a moment to run through a few of the updates and improvements that have been made since 1.0.
New CLI argument system
There were a few complaints about the argument system not being that intuitive. Originally we were using yargs, this meant you'd end up with commands like:
$ mdpdf --source=README.md --style=readme-style.css --header=header.hbs --headerHeight=20
We've now moved over to meow which handles a much bigger range of argument types. Now you can use commands like this:
$ mdpdf README.md --style readme-style.css --header header.hbs --hHeight 20
We also renamed of
headerHeight flag to
hHeight which is a bit shorter and harder to fumble.
Better header support
From 1.0 until now, styling the header had to be done somewhat separately from the rest of the pages CSS. This is due to how it's processed and the fact that the header is actually removed from the main body when being processed.
We've now shifted a few things around to fix this problem altogether, styling should now be applied to headers and footers (we'll get to that) the same as the main PDF body.
We've now added footers, they work much the same as headers but with two new flags.
--fHeight, these two work the same as the header.
You can now add a document wide footer to your PDF's with the same styling as the main body of the document.
Headers and footers now use HTML rather than Handlebars
Within mdpdf we use a templating system, this lets us convert your markdown into HTML and then mix it together with various stylesheets and any headers or footers. To keep uniformity we forced users to use Handlebars to write their headers and footers, we realised this didn't make much sense for a few reasons.
- It alienates people who haven't used Handlebars before, especially those who aren't web developers.
- We don't actually use any Handlebars features within the headers and footers, meaning we could just have them as plain HTML and inject them into our templates.
While handlebars still works for headers and footers, we now suggest using plain old HTML. This hasn't removed any features, it's simply renamed your files for simplicity sake.
There are a number of other smaller changes that have been implemented and a few document upgrades. We've also begun working on greater test coverage for the module to give you peace of mind.