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.0b1 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.0b1.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.0b1-py3-none-any.whl (104.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: diagram_pptx-0.1.0b1.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.0b1.tar.gz
Algorithm Hash digest
SHA256 d02f1abb2c768c26d391bd53c1e454d02d9bddc39cc781cf107e55b547b83274
MD5 e6131981b99eba471e5419bfbf0187e5
BLAKE2b-256 06380aca8f670a2f6ff26f590961f803f94c4ab29aeb50a96ba9eaadf246c9da

See more details on using hashes here.

Provenance

The following attestation bundles were made for diagram_pptx-0.1.0b1.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.0b1-py3-none-any.whl.

File metadata

  • Download URL: diagram_pptx-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 104.2 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.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 637a368494ec6dfa22932480e9509e38ff8722920c0d51fa85fb7c559d10b971
MD5 2cda4387fdaab06d4045854a483e9072
BLAKE2b-256 cc023b9e44d26956bd318b6ecbaecef0e121b2bf3df31e6e6ee2710a8bdf700c

See more details on using hashes here.

Provenance

The following attestation bundles were made for diagram_pptx-0.1.0b1-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