-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Programmatic API #25
Comments
@simonhaenisch Can we use this in a node app? |
This refactors the main convertToPdf function and exposes it from `util/md-to-pdf.js`, so it can be shared between the new programmatic API and the CLI. The CLI has been moved to `cli.js` and `index.js` exposes a wrapper around `mdToPdf` instead. Closes #25
@ceddybi I just worked on this and got something ready, however it'll be a very simplistic API for now (basically it'll expose a function Here's an example of how to use it: 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);
}
})(); I'm planning on changing the API to accept a list of files and to allow for concurrent conversions, however that'll require a couple more changes and one breaking change. I'll make this available in the next release. Just need to update the readme. |
@ceddybi this is now released in |
To make the package easier to use as a dependency of other packages, a programmatic API would probably be helpful for some people. Should be a pretty straight-forward refactoring task.
The text was updated successfully, but these errors were encountered: