Skip to content

Releases: simonhaenisch/md-to-pdf

2.5.0

20 Jan 22:56
Compare
Choose a tag to compare

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

27 Oct 01:30
Compare
Choose a tag to compare

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

14 Oct 23:12
Compare
Choose a tag to compare
  • 🎉 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 to defaults, 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

15 Sep 08:16
Compare
Choose a tag to compare

Added a spinner for better feedback.

2.1.2

10 Sep 11:35
Compare
Choose a tag to compare

This release...

  • Updates dependencies ([email protected]).
  • Adds a post-merge hook to auto-run npm install after a git pull but only if package.json was modified.
  • Replaces the serve dependency with serve-handler which simplifies the implementation. Furthermore serve had a security vulnerability.
  • Fixes some typos.

2.1.0

29 May 03:15
Compare
Choose a tag to compare

(includes notes for v2.0.1)

Features

  • allow pdf_options.margin to be passed as a CSS-like margin (ad4854b)
  • nicer code block formatting: lighter background, border radius (d8a8e32)
  • update dependencies marked, chalk and iconv-lite (fd146d3)

Fixes

  • invalidate --html-pdf-options in favor of --pdf-options (82bd49d)
  • set CSS media type to screen before writing PDF (c5274e3)
  • set pdf_options.printBackground: true so background colors are printed (a638f0e)

2.0.0

28 May 23:49
Compare
Choose a tag to compare

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.