Skip to main content

Compile Mermaid into editable native PowerPoint diagrams with python-pptx

Project description

English · 日本語

diagram-pptx

Mermaid in. Editable PowerPoint shapes out.

CI Python 3.10–3.13 MIT License Package status

diagram-pptx parses Mermaid into typed Python models and renders editable PowerPoint AutoShapes, connectors, text, and groups. The same diagram can also be exported to SVG, PNG, or JPEG.

Flow, sequence, class, and state diagrams generated by diagram-pptx

Install

pip install diagram-pptx

For PNG and JPEG export:

pip install "diagram-pptx[image]"

Quick start

from pptx import Presentation
from diagram_pptx import render_mermaid

source = """
flowchart LR
    request[Request] --> review{Approved?}
    review -->|yes| publish[Publish]
    review -->|no| request
"""

prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6])

render_mermaid(source, slide=slide, position="full")
prs.save("diagram.pptx")

Native rendering is the default and needs no Node.js, PowerPoint, Docker, or LibreOffice. The resulting diagram is movable, resizable, ungroupable, and addressable by semantic ID.

from diagram_pptx import parse_mermaid

diagram = parse_mermaid(source)
diagram.model.nodes["publish"].label = "Release"
diagram.save("diagram.svg")
diagram.save("diagram.png", dpi=300)

Highlights

  • All Mermaid 11.16 syntax families through Official geometry
  • Typed models and Pure Python Native layout for flowchart, sequence, class, ER, and state
  • Mutable typed models with parse/edit/compile workflows
  • Editable native PowerPoint output through python-pptx
  • Pure Python Native layout and optional Mermaid CLI Official geometry
  • Themes, class/ID overrides, automatic text contrast, and color maps
  • Inch bounds, named slide regions, and normalized 0..1 placement
  • SVG plus optional high-resolution PNG/JPEG export

Documentation

0.1.0b2 is a beta release. Unsupported Mermaid syntax is reported rather than silently discarded. See the user guide for the support matrix and backend behavior.

License

MIT

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

diagram_pptx-0.1.0b2.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

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

diagram_pptx-0.1.0b2-py3-none-any.whl (104.4 kB view details)

Uploaded Python 3

File details

Details for the file diagram_pptx-0.1.0b2.tar.gz.

File metadata

  • Download URL: diagram_pptx-0.1.0b2.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for diagram_pptx-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 2c2803dbf6fea0b5f5e3a4b7708afae44c239a7d5e5af22bf2ae9c55fd12065c
MD5 82c420bdb2e52aa1c7fb128ba3cc0fe8
BLAKE2b-256 89c72b68c5d41beb5a2da76702b2bdf3ce16011edd13324b27478545732a9177

See more details on using hashes here.

Provenance

The following attestation bundles were made for diagram_pptx-0.1.0b2.tar.gz:

Publisher: publish.yml on sci-gen/diagram-pptx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diagram_pptx-0.1.0b2-py3-none-any.whl.

File metadata

  • Download URL: diagram_pptx-0.1.0b2-py3-none-any.whl
  • Upload date:
  • Size: 104.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for diagram_pptx-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 8da660251f62b6842b20e40f00fdb9114c74116c375e310d25387212eca400a4
MD5 2cfbeca63b707112890e70246e8ada59
BLAKE2b-256 5b8456311fce93131e170648a55765979650622f549e1d8a4fdaee35e05d129e

See more details on using hashes here.

Provenance

The following attestation bundles were made for diagram_pptx-0.1.0b2-py3-none-any.whl:

Publisher: publish.yml on sci-gen/diagram-pptx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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