Convert Markdown to DOCX with support for Mermaid diagrams
Project description
md_to_docx
A Python tool to convert Markdown documents to DOCX format with special support for Mermaid diagrams.
Features
- Convert Markdown to DOCX while preserving formatting
- Render Mermaid diagrams as images in the resulting DOCX file
- Support for common Markdown elements:
- Headers
- Lists (ordered and unordered)
- Tables
- Bold and italic text
- Code blocks
- And more!
Installation
pip install md_to_docx
Usage
Command Line
md-to-docx input.md output.docx
Python API
from md_to_docx import md_to_docx
# Convert markdown to docx
md_to_docx("path/to/input.md", "path/to/output.docx")
# Or with string content
markdown_content = "# Hello World\n\nThis is a test."
md_to_docx(markdown_content, "output.docx")
MCP Server
This tool can also be used as an MCP server:
from mcp.client import Client
client = Client()
result = client.md_to_docx(md_content="# Hello World", output_file="output.docx")
Mermaid Support
The tool automatically renders Mermaid diagrams found in the Markdown. Example:
```mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Do Something]
B -->|No| D[Do Nothing]
```
Requirements
- Python 3.8+
- Dependencies are automatically installed with the package
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
md_to_docx-0.1.0.tar.gz
(7.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md_to_docx-0.1.0.tar.gz.
File metadata
- Download URL: md_to_docx-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
379297cdc743ff20e988b04b72f0601c750d2a3316a2cac248cb166f8d26e88d
|
|
| MD5 |
9d5ad42d0df36f35b3c2f9676ae76f77
|
|
| BLAKE2b-256 |
cfc6a6ce2eb7c9a8c9acd626fea9e59e93b5f2708d3b9705ccc23d5c2e54b92a
|
File details
Details for the file md_to_docx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: md_to_docx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7964abeb105fb11c216c69f888d7674d9ad1ff724f95db900a8d90aeb7c2108e
|
|
| MD5 |
04a0b7264e460b5cb58e49b8761b6f52
|
|
| BLAKE2b-256 |
76effee0523c1f070524d1ef38fc7807f9bd275f99a573f89ff0e0678a577aeb
|