A robust Python tool that converts Markdown files with Mermaid diagrams to PowerPoint (PPTX) and PDF formats without cutting any content.
- ✅ Large Diagram Support: Handles Mermaid diagrams up to 10M characters
- ✅ No Content Clipping: Automatically scales diagrams to fit slides/pages
- ✅ Smart Pagination: Proper page breaks for PDFs
- ✅ PowerPoint Export: Creates professional presentations with proper slide layout
- ✅ PDF Export: Generates PDFs with correct pagination
- ✅ Code Block Support: Syntax-highlighted code blocks in both formats
- ✅ Headless Rendering: Uses Playwright for consistent diagram rendering
- Clone the repository:
git clone <repository-url>
cd ppt- Install dependencies:
pip install -r requirements.txt- Install Playwright browsers:
playwright install chromium
# or use the built-in command:
python main.py --install-playwrightConvert to both PowerPoint and PDF:
python main.py input.mdpython main.py input.md -f pptxpython main.py input.md -f pdfpython main.py input.md -o output_name -f both# Test with the included example
python main.py test_document.md
# This creates:
# - test_document.pptx
# - test_document.pdf- Parsing: Extracts content blocks (text, headings, code, mermaid) from Markdown
- Rendering: Uses Playwright to render Mermaid diagrams with proper sizing
- Export:
- PowerPoint: Intelligent slide creation with automatic content fitting
- PDF: Proper pagination with no content cutoff
The system uses:
- Playwright for headless browser-based Mermaid rendering
- python-pptx for PowerPoint generation
- ReportLab for PDF generation
- Markdown for parsing with custom Mermaid extension
- Python 3.9+
- Chromium (installed via Playwright)
MIT