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_input.md:

first line

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

end lint

demo_input_png.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.1.0.tar.gz (64.9 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.1.0-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

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

Hashes for mdsvg2png-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d390634159387a8369ebbbf9aa1eef6e8eb457a549268a25c8051080b955e36f
MD5 bd4cd9c528a14f8f69fdc5b888269f55
BLAKE2b-256 39e6c9380474243f64d136de2801b1148f4ea55763d58050a7750a0447e08814

See more details on using hashes here.

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

Hashes for mdsvg2png-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb2296e6d15a60c93c8c865a42e19f0ccafee5fba765d853ad6443967fccc507
MD5 f2cbd6b3537fde56bca7ab0a2cf20190
BLAKE2b-256 83d8277205dac61401442c67b5c478a36acc19ed5cc35f9677e16299918304dd

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