You have a Markdown file and need a PDF: a report, a CV, meeting notes. Open the app, paste or drop the file, and save it as a PDF. No account, no upload, no install, and it keeps working offline.
Live app: md2pdf.marcopontili.com
Desktop (left) · Mobile (right)
- Type or paste Markdown, or import a
.mdfile (button or drag and drop, up to 2 MB). - Watch the preview render as you type, styled like GitHub.
- Click Export to .pdf and choose Save as PDF in the print dialog. The file is named after the document's first heading.
On small screens the editor and preview become two tabs. The app follows your system theme, or pick light or dark from the toolbar.
- GitHub-flavored Markdown: tables, task lists, footnotes, and syntax-highlighted code.
- Mermaid diagrams from fenced
mermaidcode blocks. - Layout control through allow-listed inline HTML and
<style>blocks, for CVs and reports. - Installable and offline as a PWA after the first visit.
- Agent bridge: coding agents drive the app through
window.md2pdf(docs).
Documents stay in the browser tab; nothing is uploaded for conversion or stored.
- Sanitized rendering. Raw HTML is parsed with
rehype-raw, thenrehype-sanitizekeeps only an allow-list of tags and attributes. Scripts, event handlers, andjavascript:links are removed. - Mermaid runs with
securityLevel: 'strict'. - Content Security Policy allows scripts from the app's own origin only. Images with an
httpsaddress in a document load from their host. - Hosting: HTTPS behind Cloudflare, with HSTS,
nosniff,frame-ancestors 'none', and a strict Permissions-Policy.
Report vulnerabilities as described in SECURITY.md.
| Layer | Stack |
|---|---|
| Frontend | React 19, CodeMirror 6, react-markdown, remark-gfm, rehype-raw, rehype-sanitize, highlight.js, Mermaid, styled-components |
| Framework and build | Vite, vite-plugin-pwa (Workbox) |
| Backend | None: a static single-page app; conversion runs in the tab |
| Server | Apache behind Cloudflare, deployed from GitHub Actions |
git clone https://github.com/marcop135/md2pdf.git
cd md2pdf
npm ci
npm start # http://localhost:5173More commands: docs/commands.md.
Started as a fork of realdennis/md2pdf (MIT); thanks to Dennis for the original app. This version adds Mermaid, GitHub-flavored Markdown, offline support, the agent bridge, tests, and CI.
Read CONTRIBUTING.md, then report a bug or request a feature.

