Releases: lancer-code/md2pdf
v1.0.1 — Network fallback for libavif
Problem v1.0.0 didn't solve
The v1.0.0 installer had a 2-tier fallback for the Ubuntu 24.04
libavif.so.16 problem:
- Look in system paths
- Search
$HOMEfor vendored copies inside Python wheels (Pillow, OpenCV)
If you had neither a system libavif package nor any Pillow/OpenCV
anywhere in your home directory, the installer would give up with a
sudo apt install libavif16 hint — which required root and didn't work
for every user (shared servers, restricted systems, no sudo).
The v1.0.1 fix
install.sh now has a third fallback: download a pre-built shim from the
md2pdf GitHub release over HTTPS. The complete chain is:
| # | Source | Requires |
|---|---|---|
| 1 | Prince runs as-is | — |
| 2 | System paths (/usr/lib/..., /usr/local/lib/...) |
distro libavif package |
| 3 | $HOME filesystem walk |
Pillow, OpenCV, or other vendored wheel |
| 4 | GitHub release download (NEW) | curl + internet access |
| 5 | Clear platform-specific error with install instructions | — |
The download is:
- Self-contained — depends only on standard libc, libstdc++, libm
- ELF-validated before staging so a mirror serving HTML error pages can't break the install
- Version-pinned to v1.0.0 release assets (URL is permanent)
- Linux x86_64 only — macOS and ARM Linux users get a platform-specific error with the correct
brew/apt/dnfcommand
Other improvements
- 10-second timeout on the
$HOMEfilesystem walk so the installer can't hang on huge home directories or broken NFS mounts - Better error messages — every failure path now includes the exact command to run next (
sudo apt install libavif16,brew install libavif, etc.) - Architecture detection — no more attempting to install an x86_64 shim on ARM
- Documented fallback chain at the top of
install.shso readers can understand the logic without tracing the code
What's in the v1.0.0 release that v1.0.1 depends on
The v1.0.1 installer downloads these assets (originally attached to v1.0.0):
libavif-shim-linux-x86_64.so(5.1 MB) — pre-built libavif, BSD-2-Clause, self-containedlibavif-LICENSE— full license text from upstream libavif
These stay pinned to v1.0.0 for stability. The v1.0.1 release itself only contains updated source code (no asset changes).
Upgrade
cd md2pdf
git pull origin main
./install.shOr re-install from scratch:
git clone https://github.com/lancer-code/md2pdf.git
cd md2pdf
./install.shEnd-to-end test performed
Before shipping, I removed my local shim and re-ran ./install.sh on a
clean state. The installer correctly:
- Detected Prince failure
- Searched system paths — no match
- Searched
$HOME— no match (after removal) - Downloaded the shim from the v1.0.0 release
- Validated the ELF header
- Staged it at
~/.local/lib/prince-deps/libavif.so.16 - Re-ran
prince --versionsuccessfully
Total time: ~3 seconds over decent bandwidth.
Full changelog: CHANGELOG.md
Compare: v1.0.0...v1.0.1
v1.0.0 — Initial release
First public release of md2pdf — a single-file bash script that converts Markdown to a print-ready PDF in one command, powered by Prince and marked.
Highlights
- One command, one file in, one PDF out.
md2pdf notes.md→notes.pdf. - Print-optimized CSS baked in. A4 margins, running header, page-number footer, zebra-striped tables, wrapping code blocks, smart page breaks.
- No global npm installs.
markedis fetched on-demand vianpx --yes marked@14— no pollution of your global tree, pinned for reproducibility. - Idempotent installer.
./install.shis safe to re-run any number of times. - Auto-detected libavif shim. On Ubuntu 24.04 where Prince fails to load
libavif.so.16, the installer automatically finds a usable copy on your machine (including Pillow / OpenCV Python wheels that vendor their own) and stages it at~/.local/lib/prince-deps/. - Helpful errors. Missing
prince? Missingnpx? Broken libavif? You get a clear one-line error that tells you exactly what to install. - Readable in one sitting. The entire converter is ~300 lines of bash and CSS — copy it anywhere, tweak it freely.
What's included
md2pdf— the portable single-file scriptinstall.sh— idempotent installer with automatic libavif discoveryexamples/sample.md+examples/sample.pdf— full feature showcase, rendered output committed so you can preview without installingREADME.md— comprehensive documentation with install, usage, CSS customization guide, comparison withmd-to-pdf/pandoc/WeasyPrint/mdpdf/wkhtmltopdf, libavif shim explainer, and troubleshootingCONTRIBUTING.md— project philosophy and development workflowCHANGELOG.md,LICENSE(MIT)
Quick start
git clone https://github.com/lancer-code/md2pdf.git
cd md2pdf
./install.sh
md2pdf examples/sample.mdRequirements
- Prince — free for non-commercial use
- Node.js ≥ 18 (for
npx) - bash ≥ 4
- Linux or macOS
Known limitations
- Prince is not fully open source. Free for non-commercial use with a small watermark; paid for commercial use. See the Prince license FAQ.
markedis pinned to14.xfor reproducibility.- macOS users may need
brew install coreutilsforreadlink -f. - WSL and Windows native bash are untested.
Why
Most Markdown-to-PDF tools either ship an entire headless Chromium (200 MB+) or require a full LaTeX installation (500 MB+). md2pdf uses Prince — a small purpose-built HTML-to-PDF engine with excellent print CSS support — to give you fast, deterministic output from a script you can read in ten minutes.
See the README's comparison table for an honest breakdown of when to pick md2pdf vs its alternatives.
Full changelog: CHANGELOG.md