md2beauty is an open-source tool designed to convert Markdown files into beautiful and professional formats such as HTML, DOCX, PPTX, and PDF. It supports themes and advanced diagram rendering using tools like Mermaid.
The purpose of this library is to be able to "render" markdown document beautifully in a variety of legacy formats such as Microsoft Word (.docx), Microsoft PowerPoint (.pptx) and PDF.
- Multi-format Conversion: Convert Markdown to HTML, DOCX, PPTX, and PDF.
- Theme Support: Apply custom themes to your output formats for a polished look.
- Diagram Rendering: Supports JS-based diagrams like Mermaid for visual content.
- CLI Integration: Easy-to-use command-line interface for seamless conversions.
- Beautiful out of the box: Avoid having to tweak the files afterwards enabling a fast and easy use.
For all output formats:
pip install md2beauty[all]For specific output format only:
pip install md2beauty[docx,pptx,pdf,html]Use only the ones you are interested in.
Mermaid rendering uses a tiny Node-based JS backend. Bundle once, then it works without extra CLI tools:
- Ensure Node.js is installed:
node -v
npm -v- Install dev deps and bundle the renderer:
npm install
node scripts/bundle-mermaid.mjsThis produces md2beauty/js_renderers/mermaid.bundle.mjs used at runtime.
If Mermaid isn’t bundled and Node/scripts aren’t available at runtime, diagrams are skipped unless strict mode is enabled.
Convert Markdown files using the CLI:
python -m md2beauty.cli -f <format> -i <input_file> -o <output_file><format>: Output format (html,docx,pptx,pdf).- Default is
html
- Default is
<input_file>: Path to the Markdown file.<output_file>: Path to save the converted file.- Optional, if not present, base name of
input_filewithformatas an extension.
- Optional, if not present, base name of
Convert a Markdown file to PDF:
python cli.py -f pdf -i example.md -o example.pdf- CLI tool
- HTML conversion
- DOCX/PPTX conversion
- PDF conversion (using WeasyPrint)
- Theme system
- Mermaid/diagram support
- Adding code languages highlighting support
- Prepare for PIP packaging and dividing into output and render features to lower dependencies depending on needs
- Make Documentation actually useful
- First release on piphub
- Advanced customization options
- Plugin system for additional
| Name | Description | License Type | Main Language |
|---|---|---|---|
| Jupyter nbconvert | Converts Jupyter notebooks (Markdown + code) to HTML, PDF, and more | BSD | Python |
| MkDocs | Fast, simple and downright gorgeos static site generator | BSD | Python |
| Grip | Preview GitHub-flavored Markdown with export to HTML | MIT | Python |
| Pandoc | Universal document converter supporting Markdown to many formats (HTML, DOCX, PDF, etc.) | GPL | Haskell |
| Marp | Markdown presentation tool converting Markdown to slides (HTML, PPTX, PDF) | MIT | TypeScript |
| Typora | Markdown editor with export options to DOCX, PDF, and HTML | Proprietary | JavaScript |
| md-to-pdf | Node.js tool to convert Markdown files directly to PDF | MIT | JavaScript |
| markdown-pdf | Node.js utility for converting Markdown to PDF | MIT | JavaScript |
| remarkable | Markdown parser and compiler with plugins for various output formats | MIT | JavaScript |
| reveal-md | Create reveal.js presentations from Markdown files | MIT | JavaScript |
| Name | Description | License Type | Main Language |
|---|---|---|---|
| readme2readall | Converts Markdown to Word with Mermaid Support | MIT | Python |
- Offline capacity: No relying on github API calls to render markdown
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.
This project includes a distribution bundle of:
- mermaid under MIT License.