An open-source Markdown to PDF converter with support for multiple Markdown flavors.
MD2PDF is a desktop application that simplifies the process of converting Markdown documents to professionally formatted PDF files. The application supports multiple Markdown flavors and provides a live preview, allowing you to see your document exactly as it will appear in the exported PDF.
- Multiple Markdown Flavors: Support for CommonMark, GitHub Flavored Markdown, and custom extensions
- Live Preview: Real-time preview of your Markdown as you type
- Syntax Highlighting: Code blocks are highlighted using highlight.js
- Customizable Styling: PDF output can be styled with custom CSS
- Cross-Platform: Works on Windows, macOS, and Linux
- User-Friendly Interface: Intuitive split-screen layout with editor and preview panes
- Node.js (v14 or higher)
- npm (included with Node.js)
-
Clone the repository:
git clone https://github.com/Rmiddaugh10/md2pdf.git cd md2pdf -
Install dependencies:
npm install -
Start the application in development mode:
npm run dev -
Build distributable packages:
npm run build
- Open a Markdown File: Click the "Open" button to load an existing Markdown file
- Edit Your Markdown: Use the editor on the left side to write or edit your Markdown
- Choose a Markdown Flavor: Select your preferred Markdown flavor from the dropdown menu
- Export to PDF: Click the "Export to PDF" button to save your document as a PDF
Basic Markdown standard with support for:
- Headers
- Lists (ordered and unordered)
- Links and images
- Bold and italic text
- Code blocks
- Blockquotes
- Horizontal rules
Extends CommonMark with:
- Tables
- Task lists
- Strikethrough
- Automatic URL linking
- Syntax highlighting for code blocks
The custom flavor allows for additional extensions:
- Math expressions using TeX syntax
- Custom block syntax
- Additional parsing rules
md2pdf/
├── src/
│ ├── index.js # Main entry point
│ ├── parser/
│ │ ├── index.js # Parser factory
│ │ ├── commonmark.js # CommonMark parser
│ │ ├── github.js # GitHub Flavored Markdown parser
│ │ └── custom.js # Custom flavor parser
│ ├── renderer/
│ │ ├── index.js # Renderer factory
│ │ └── pdfRenderer.js # PDF rendering logic
│ └── ui/
│ ├── index.js # UI initialization
│ ├── components/ # UI components
│ └── styles/ # CSS styles
├── public/
│ ├── index.html # Main HTML file
│ └── assets/ # Images, icons, etc.
├── build/
│ └── icons/ # Application icons
├── package.json # Dependencies and scripts
├── README.md # Project documentation
└── LICENSE # MIT License
The project includes scripts for building platform-specific packages:
npm run build:mac # Build macOS package
npm run build:win # Build Windows package
npm run build:linux # Build Linux package
Run the test suite with:
npm test
- Create a new parser implementation in
src/parser/ - Update the parser factory in
src/parser/index.js
- Create a new renderer in
src/renderer/ - Update the renderer factory in
src/renderer/index.js
Future enhancements planned for MD2PDF:
- Custom CSS editor for styling PDF output
- Template system for common document formats
- Document outline/navigation panel
- Export to additional formats (HTML, DOCX)
- Spellchecking and grammar checking
- Improved math rendering
- Diagram support (mermaid, PlantUML)
Contributions are welcome! Please see CONTRIBUTING.md for details on how to contribute to this project.
This project is licensed under the MIT License - see the LICENSE file for details.
- marked - Markdown parser
- highlight.js - Syntax highlighting
- html-pdf-node - HTML to PDF conversion
- CodeMirror - Text editor implementation
- Electron - Framework for building desktop applications
Made with ❤️ by Robert
