Skip to main content

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

  1. Install dependencies:
    pip install mdsvg2png
    playwright install
    
  2. Run the script:
    mdsvg2png your_markdown.md
    

Demo

demo.md:

first line

![Version constructor](https://iscinumpy.dev/post/packaging-faster/version.TimeVersionSuite.time_constructor.svg)

end lint

demo_output.md

first line

![Version constructor](https://pic-1251484506.cos.ap-guangzhou.myqcloud.com/svg2png/version.TimeVersionSuite.time_constructor_3950bb8a.png)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdsvg2png-0.2.0.tar.gz (65.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdsvg2png-0.2.0-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

File details

Details for the file mdsvg2png-0.2.0.tar.gz.

File metadata

  • Download URL: mdsvg2png-0.2.0.tar.gz
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for mdsvg2png-0.2.0.tar.gz
Algorithm Hash digest
SHA256 98079e86ddce169eb853283e066cb3fb016e2654eed2cf316d94e2a4a744deee
MD5 2bcbf0fee03efb20cd8d9fbc8b3a98d0
BLAKE2b-256 4ff56b2a03a448759102ee5cd6417353d738e9c9a3372873232a709309f17bd0

See more details on using hashes here.

File details

Details for the file mdsvg2png-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mdsvg2png-0.2.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

Hashes for mdsvg2png-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 639cfea9321e444f7ea045176ebf75cc98dd4556e947e166401c05cf7f877610
MD5 01635f402a5c1b0f49101e0aa88f02e9
BLAKE2b-256 a1c1b48bdd2816360e19f6bc073025bb739905ed779cd6ff22460544bf0a17c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page