I Built a Markdown-to-PDF Converter That Never Touches a Server
MarkPDF Lite is live now: https://qtnt2xxx-wq.github.io/markpdf-lite/ Most "paste your text, get a PDF" tools upload your document to a server. That means your notes, contracts, or drafts sit in someone else's queue and
MarkPDF Lite is live now: https://qtnt2xxx-wq.github.io/markpdf-lite/
Most "paste your text, get a PDF" tools upload your document to a server. That means your notes, contracts, or drafts sit in someone else's queue and probably in their logs.
MarkPDF Lite takes the opposite approach: the entire conversion pipeline runs in your browser tab. Zero uploads, zero tracking, zero server.
How it works
The whole app is 4 static files (HTML + CSS + a small script) hosted on GitHub Pages. Two CDN libraries do the heavy lifting:
- markdown-it parses your Markdown into HTML locally:
const md = window.markdownit({
html: false, // raw HTML is escaped, not injected
linkify: true, // bare URLs become clickable
breaks: true // single newlines render as <br>
});
- html2pdf.js (a jsPDF + html2canvas bundle) rasterizes the rendered preview into a paginated PDF and triggers the download, entirely on your machine.
The live preview re-renders on every keystroke via a single input listener, so what you see is exactly what you download:
function render() {
docEl.innerHTML = md.render(mdEl.value);
}
mdEl.addEventListener("input", render);
Design decisions
- html: false means user input is treated as Markdown, never as executable HTML. No XSS surface from the editor itself.
- No build step, no framework: plain script in an IIFE, two pinned CDN versions. The whole site weighs a few KB.
- Deterministic output: fixed margins and A4-style pagination handled by html2pdf's pagebreak rules.
Try it
Type some Markdown on the left, watch the preview update, hit Download PDF. Your text never leaves the page, and you can verify this yourself in the Network tab (there are no XHR calls).
If you find it useful, a small tip keeps this project alive:
- PayPal: [email protected] (memo: BOX-f1da5955c6a3)
- ETH: 0xF205B9630b63AEA9F8FA59E327591d3a93FCedFA
Source code is public, so feel free to fork it, break it, and improve it.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.