@huaiyukhaw/md2pdf
v1.0.0
Published
Compile Markdown files to PDF using a local Chrome/Edge install — no Puppeteer download required.
Readme
md2pdf
Compile Markdown files to PDF using a local Chrome/Edge install — no Puppeteer download required.
How it works
- Markdown is converted to HTML with
marked. - The HTML is wrapped in a GitHub-style print stylesheet. A
<base>tag points at the source file's directory, so relative image paths keep working. - Headless Chrome or Edge prints the page to PDF via
--print-to-pdf.
Install
Not yet published to the npm registry. For now, install from a local clone:
git clone <this-repo> md2pdf
cd md2pdf
npm install
npm link # makes the `md2pdf` command available globallyUndo with npm unlink -g @huaiyukhaw/md2pdf.
Once published, this will be:
npm install -g @huaiyukhaw/md2pdfRequires Node.js 18+ and a Chrome or Edge install on your machine.
Usage
md2pdf <input.md> [more.md ...] [output.pdf]Examples:
md2pdf docs/SDD.md # -> docs/SDD.pdf
md2pdf docs/SDD.md out/sdd.pdf # explicit output
md2pdf docs/*.md # one PDF per fileOptions
-h, --help show help
-v, --version print the version numberConfiguration
If auto-detection can't find a browser on your machine, point at one explicitly:
MD2PDF_BROWSER="/path/to/chrome" md2pdf docs/SDD.mdLicense
MIT
