A modern web-based application that converts Markdown documents to beautifully formatted PDFs with live preview. Built with React, Vite, and @react-pdf/renderer for high-quality native PDF generation.
β¨ Live Preview - See your markdown rendered in real-time as you type
π Rich Markdown Support - Headers, lists, tables, code blocks, blockquotes, and more
π¨ Beautiful PDFs - Native PDF generation with crisp text at any zoom level
πΎ Auto-Save - Your work is automatically saved to browser storage
π Fast & Responsive - Optimized for performance
βοΈ Serverless - No backend required, PDF generation happens entirely in the browser
π Searchable PDFs - Generated PDFs have real text, not images
Split-pane interface with live markdown editor on the left and rendered preview on the right.
- React 18 - UI framework
- Vite - Build tool
- @react-pdf/renderer - Native PDF generation (vector text, not screenshots)
- markdown-it - Markdown parser
- DOMPurify - XSS protection
- Prism.js - Syntax highlighting for preview
Try it now: markdown-2-pdf.com
- Node.js 18 or higher
- npm
- Clone the repository
git clone https://github.com/LapchienSun/Markdown-To-PDF.git
cd markdown-to-pdf- Install dependencies
npm install- Run the application
npm run dev- Open your browser
- Navigate to
http://localhost:3000 - Start writing markdown and see it rendered in real-time
- Click "Export as PDF" to generate a PDF
This project is optimized for Vercel deployment:
- Push your code to GitHub
- Import the repository in Vercel
- Vercel will auto-detect the settings from
vercel.json - Deploy!
Or use the Vercel CLI:
npx vercelmarkdown-to-pdf/
βββ packages/
β βββ web/ # React frontend
β βββ src/
β β βββ components/ # React components
β β β βββ Editor.jsx # Markdown editor
β β β βββ Preview.jsx # Live preview
β β β βββ Toolbar.jsx # Top toolbar with PDF export
β β β βββ ResizablePanes.jsx
β β β βββ Notification.jsx
β β βββ hooks/ # Custom React hooks
β β β βββ useMarkdown.js
β β β βββ useLocalStorage.js
β β βββ styles/ # CSS files
β β βββ utils/
β β β βββ markdownParser.js # HTML preview parser
β β β βββ pdfRenderer.jsx # Markdown to PDF components
β β βββ App.jsx
β β βββ main.jsx
β βββ package.json
β βββ vite.config.js
β
βββ package.json # Monorepo root with workspaces
βββ vercel.json # Vercel deployment config
βββ README.md
| Feature | Preview | |
|---|---|---|
| Headers (H1-H6) | β | β |
| Bold, Italic, Strikethrough | β | β |
| Ordered and Unordered Lists | β | β |
| Nested Lists | β | β |
| Code Blocks | β | β |
| Inline Code | β | β |
| Tables | β | β |
| Blockquotes | β | β |
| Horizontal Rules | β | β |
| Links | β | β |
| Images | β | β |
| Task Lists | β | β |
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewThis project uses npm workspaces. The web application lives in packages/web/.
To add new packages to the monorepo, create a new folder in packages/ with its own package.json.
Unlike screenshot-based PDF generators, this app uses @react-pdf/renderer which:
- Parses your markdown into tokens using
markdown-it - Converts tokens to React PDF components (
<Text>,<View>,<Link>, etc.) - Generates a native PDF with real vector text
Benefits:
- π Crisp text at any zoom level
- π Text is searchable and selectable
- π¦ Smaller file sizes
- π― Consistent rendering across devices
- HTML sanitization with DOMPurify (for preview)
- All processing happens client-side (no data sent to servers)
- No cookies or tracking
- Your documents never leave your browser
Expected Performance:
- Preview rendering: <100ms
- PDF generation: 1-3 seconds (depends on document size)
- No cold starts (fully client-side)
Document Size Limits:
- Recommended max: ~50 pages
- Larger documents may slow down PDF generation
Contributions are welcome! Please read our Contributing Guide and Code of Conduct before submitting pull requests.
Quick steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See detailed guidelines in CONTRIBUTING.md.
This project is licensed under the MIT License - see the LICENSE file for details.
- @react-pdf/renderer - Native PDF generation for React
- markdown-it - Markdown parser
- Prism.js - Syntax highlighting
- DOMPurify - XSS sanitization
- π Report Bugs
- π‘ Request Features
- β Ask Questions
Made with β€οΈ by Chris Carswell