A tool to convert SVG images in Markdown files to PNG.
Project description
mdsvg2png
A simple Python tool to convert SVG images in Markdown files to PNG format(upload converted .pngs to the Tencent cos).
Features
- Automatically detects SVG images in Markdown.
- Converts SVG to PNG for better compatibility.
- Easy to use and integrate.
Config
.env or configure environment variables:
COS_SECRET_ID=<xyz>
COS_SECRET_KEY=<xyz>
COS_REGION=<xyz>
COS_BUCKET=<xyz>
Usage
- Install dependencies:
pip install mdsvg2png playwright install
- Run the script:
mdsvg2png your_markdown.md
Demo
demo_input.md:
first line

end lint
demo_input_png.md
first line

end lint
Note
Depend on playwright to support rendering <foreignObject> tag in svg.
TODO: Use resvg_python for static svg.
License
Apache License
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
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 mdsvg2png-0.1.0.tar.gz.
File metadata
- Download URL: mdsvg2png-0.1.0.tar.gz
- Upload date:
- Size: 64.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d390634159387a8369ebbbf9aa1eef6e8eb457a549268a25c8051080b955e36f
|
|
| MD5 |
bd4cd9c528a14f8f69fdc5b888269f55
|
|
| BLAKE2b-256 |
39e6c9380474243f64d136de2801b1148f4ea55763d58050a7750a0447e08814
|
File details
Details for the file mdsvg2png-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mdsvg2png-0.1.0-py3-none-any.whl
- Upload date:
- Size: 65.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb2296e6d15a60c93c8c865a42e19f0ccafee5fba765d853ad6443967fccc507
|
|
| MD5 |
f2cbd6b3537fde56bca7ab0a2cf20190
|
|
| BLAKE2b-256 |
83d8277205dac61401442c67b5c478a36acc19ed5cc35f9677e16299918304dd
|