# MD2PDF — Complete Documentation for AI Agents
> MD2PDF is a free, open-source online tool that converts Markdown (.md) into styled PDFs, HTML files and PNG images, with Mermaid diagrams, an auto table of contents and syntax highlighting for 180+ languages. Conversion runs in the browser with no signup. Documents can also be shared as end-to-end encrypted links (AES-256-GCM). Agents share through the md2pdf-studio CLI, its MCP server, or an installable AI skill built on it.
Website: https://md2pdf.studio
GitHub: https://github.com/JSiapoDEV/md2pdf
npm: https://www.npmjs.com/package/md2pdf-studio
Last updated: 2026-11-11
---
## Features
- Live split-pane editor with real-time Markdown preview
- GitHub-Flavored Markdown (GFM) support
- Syntax highlighting for 180+ programming languages (via highlight.js)
- **Mermaid diagram rendering** (flowcharts, sequence diagrams, Gantt charts, pie charts, etc.)
- **Auto table of contents** — write `[TOC]` on its own line to generate a linked TOC from headings
- 11 visual styles for document rendering
- Custom CSS injection for full styling control
- Export to PDF (A4 or Letter pages, or one long page; a line with only `\newpage` starts a new page), HTML (standalone with inlined styles), and PNG image
- **End-to-end encrypted share links** — the document is encrypted on the device (AES-256-GCM) and the key stays in the link's `#k=` part, which never reaches the server
- One-time links and links with a shorter life than the 30-day default
- Link previews in chat apps show a generic card, because the server cannot read the content
- Dark and light theme toggle
- New document, 5 built-in templates, and drag-and-drop .md upload, with Undo when they replace the current text
- Word count and reading time indicator
- Auto-save of the draft to browser localStorage
- Find and replace (Ctrl+F / Ctrl+H)
- Copy button on every code block
- Installable AI skill in the Claude Skills format, the md2pdf-studio CLI and an MCP server
- WebMCP tools in the editor for browser agents (experimental: Chrome's origin trial)
- No cookies, no account; converting never uploads your file
---
## Available Visual Styles
| Style | Description |
|-------|-------------|
| notion | Clean, modern sans-serif (default) |
| github | Classic GitHub markdown rendering |
| minimal | Elegant serif typography, no decorations |
| academic | Formal justified text with a scholarly feel |
| corporate | Professional design with blue accents and styled table headers |
| latex | Simulates academic papers with Libre Baskerville typography |
| dracula | Vibrant purple, pink, and green on dark background |
| newspaper | Editorial typography with Playfair Display headings |
| handwritten | Cursive font with notebook-lined background |
| terminal | Green-on-black monospace, hacker aesthetic |
| pastel | Soft pink, purple, and teal with rounded elements |
The reader of a shared link can switch styles and download the document as PDF, HTML or PNG.
---
## Sharing from an agent: `md2pdf-studio`
The supported way for an agent to share a document. It encrypts on the machine, uploads only ciphertext and prints the link. Run it through npx with an exact version; do not install it globally. Node 18.3+, no dependencies.
```bash
npx -y md2pdf-studio@0.1.3 share report.md # or: cat report.md | npx -y md2pdf-studio@0.1.3 share
npx -y md2pdf-studio@0.1.3 share report.md --expires 7d # shorter life: 1 hour to 30 days
npx -y md2pdf-studio@0.1.3 share report.md --burn # the link opens a single time
npx -y md2pdf-studio@0.1.3 update report.md # same link, new content
npx -y md2pdf-studio@0.1.3 delete
npx -y md2pdf-studio@0.1.3 list # links made here, without keys
npx -y md2pdf-studio@0.1.3 -h # every command; says if a newer version exists
```
- Add `--json` for machine-readable output.
- Edit and encryption keys are kept in `~/.config/md2pdf-studio/links.json` (current user only), so later sessions on the same machine can update or delete a link.
- Always give the user the whole link, including `#k=`. Anyone who has it can read the document.
- Before sharing, remove secrets (API keys, tokens, passwords, customer data) or ask the user.
- Once a day the CLI checks npm for a newer version number and says so. Tell the user; update only if they agree (`npx -y md2pdf-studio@0.1.3 upgrade`). `MD2PDF_NO_UPDATE_CHECK=1` turns the check off.
### MCP server
```json
{ "mcpServers": { "md2pdf-studio": { "command": "npx", "args": ["-y", "md2pdf-studio@0.1.3", "mcp"] } } }
```
Tools: `share_markdown`, `update_shared_markdown`, `delete_shared_markdown`, `list_shared_markdown`. The server sends its sharing rules as MCP instructions.
### AI skill
The skill is a fixed text, pinned to the CLI version, that never tells the agent to fetch instructions from the web. Read it at https://md2pdf.studio/skill.md.
- Claude Code: the plugin, which updates on its own: `claude plugin marketplace add jsiapo-dev/plugins`, then `claude plugin install md2pdf-studio`. Or only the skill: `npx -y md2pdf-studio@0.1.3 skill --install`
- Claude Desktop or claude.ai: paste the skill into a chat and ask Claude to install it (or upload https://md2pdf.studio/md2pdf-skill.zip in Customize → Skills). There, code runs in a temporary sandbox: it needs network access to md2pdf.studio (Settings → Capabilities), and links made there cannot be updated or deleted later
- Codex, Cursor, Gemini CLI: add to `AGENTS.md`: "To share Markdown as a private link, run `npx -y md2pdf-studio@0.1.3 share ` and give the user the full link. Before sharing, remove secrets or ask the user."
---
## How links work
- The client (the web app or the CLI) generates a random 256-bit key and encrypts the Markdown with AES-256-GCM. It uploads `base64(IV ‖ ciphertext ‖ tag)`.
- The key is base64url-encoded into the link after `#k=`. Browsers never send that part to a server, so md2pdf.studio stores ciphertext it cannot read, search or moderate.
- The server rejects plaintext and any request that carries the key. Pages on other websites cannot call it.
- Shared pages are served with `X-Robots-Tag: noindex, nofollow, noarchive`.
- Details for anyone who wants to check: https://md2pdf.studio/api
### Limits
- **Document size:** 500 KB of Markdown (UTF-8)
- **Writes:** 10 per minute and 100 per day per address (save, update and delete combined; deleting is never limited by the daily quota)
- **Link lifetime:** 30 days after creation; updating does not extend it. A shorter life or a one-time link can be chosen when sharing
- **Account:** none
---
## Document Templates
Pre-built templates available in the editor:
1. **CV / Resume** — Professional resume layout
2. **Report** — Monthly or project report
3. **Documentation** — Technical project documentation
4. **Changelog** — Software release changelog
5. **Meeting Notes** — Structured meeting notes
---
## Supported Markdown Syntax
MD2PDF supports full GitHub-Flavored Markdown (GFM) plus extensions:
- Headings (H1–H6) with auto-generated anchor IDs
- Paragraphs with line breaks
- **Bold**, *italic*, ~~strikethrough~~
- Ordered and unordered lists
- Task lists (checkboxes)
- Code blocks with language-specific syntax highlighting (180+ languages)
- Inline code
- Tables with alignment
- Blockquotes
- Images (inline and reference)
- Horizontal rules
- Links (inline and reference)
- **Mermaid diagrams** — use ` ```mermaid ` code blocks for flowcharts, sequence diagrams, Gantt charts, pie charts, class diagrams, state diagrams, ER diagrams, and more
- **Auto table of contents** — write `[TOC]` on its own line to generate a linked table of contents from all headings
---
## Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
| Ctrl+S / Cmd+S | Export to PDF |
| Ctrl+F / Cmd+F | Find in editor |
| Ctrl+H / Cmd+H | Find and replace |
| Ctrl+Shift+L / Cmd+Shift+L | Toggle dark/light theme |
| F11 | Fullscreen |
| Tab | Insert tab in editor |
---
## Technical Details
- Pure HTML, CSS, and JavaScript — no framework, no build step
- marked.js (v12.0.1) for Markdown parsing, DOMPurify for sanitizing
- highlight.js (v11.9.0) for syntax highlighting (180+ languages)
- Mermaid for diagrams, html2canvas (v1.4.1) for image export
- GitHub Markdown CSS as base styling
- Libraries and fonts are served from md2pdf.studio itself: the app makes no third-party requests
- Hosted on Cloudflare Workers, with encrypted share links in Cloudflare KV
- Browser native print dialog for PDF export
---
## Author
Built by JSiapoDev
- Website: https://jsiapo.dev
- GitHub: https://github.com/JSiapoDEV
- LinkedIn: https://www.linkedin.com/in/jsiapo/