Releases: simonhaenisch/md-to-pdf
2.5.0
New programmatic API
md-to-pdf
can now be used programmatically instead of just from the CLI. For now, the API is very simplistic, exposing only one function mdToPdf(mdFile, config)
:
const mdToPdf = require('md-to-pdf');
(async () => {
const pdf = await mdToPdf('readme.md', { dest: 'readme.pdf' }).catch(console.error);
if (pdf) {
console.log(pdf.filename);
}
})();
dest
was added as a new config option so the pdf output path can be set.
The plan for the future is to expose an API that can take a list of files and process them concurrently, i. e. reusing the same Chromium instance. However that requires a breaking change/major release and needs a few internal changes (e. g. finding the common parent directory for all files), so I want to do some restructuring of the code first.
2.3.0
watch mode 👀
md-to-pdf --watch
(or md2pdf -w
) converts all files in the current directory and then watches them for changes... they'll be converted into PDFs again as soon as you save them.
You can also watch only a single file:
md-to-pdf --watch readme.md
Only tested on macOS, please let me know if you have any issues on other platforms.
2.2.0
- 🎉
md-to-pdf
now asynchronously/concurrently converts all markdown files in the current directory if no arguments were given. - Fixes a bug with
<
and>
creating HTML elements in code blocks if the language wasn't specified. - The config priority order was changed from
defaults, front-matter, config file, cli arguments
todefaults, config file, front-matter, cli arguments
. This is due to the change that multiple files can be converted at once now; this change allows to set options for all files from a config file while still overwriting some on a file-by-file basis using the front-matter.
2.1.3
Added a spinner for better feedback.
2.1.2
This release...
- Updates dependencies (
[email protected]
). - Adds a post-merge hook to auto-run
npm install
after agit pull
but only ifpackage.json
was modified. - Replaces the
serve
dependency withserve-handler
which simplifies the implementation. Furthermoreserve
had a security vulnerability. - Fixes some typos.
2.1.0
2.0.0
This release introduces breaking changes because html-pdf
/phantomjs
is replaced with puppeteer
(headless Chromium) to generate the PDF (will allow for more features in the future).
The old --html-pdf-options
/html_pdf_options
will not work anymore. Use --pdf-options
/pdf_options
instead. Refer to the Puppeteer docs for how to use them.
The way headers and footers work now has changed. Please refer to the updated readme section. Header/footer support in Puppeteer is not great yet, but will hopefully improve in the future.
If you want to keep using the old version with phantomjs
, just checkout the tag v1.2.1
and npm install -g
that instead.