Skip to main content

Render Mermaid diagrams to ASCII/Unicode art

Project description

mermaid-ascii-diagrams

Render Mermaid diagrams as ASCII art for terminals, plain-text documentation, emails, and environments where graphical rendering is not available.

This tool extracts Mermaid blocks from Markdown and converts them into readable ASCII diagrams.


Features

  • Converts Mermaid diagrams to plain ASCII
  • Works in terminals and text-only environments
  • CLI-first design
  • Safe to use in CI, docs pipelines, and code reviews
  • No JavaScript, no browser required

Installation

pip install mermaid-ascii-diagrams

Requires Python 3.9+.


Command-line usage

Basic usage

mermaid-ascii diagram.md

This will:

  • Read diagram.md
  • Find all fenced ```mermaid blocks
  • Render each diagram as ASCII
  • Print the result to stdout

Redirect output

mermaid-ascii diagram.md > diagram.txt

Example

Input (Markdown)

```mermaid
flowchart TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Continue]
    B -->|No| D[Stop]
```

Output (ASCII)

+--------+     +------------+
| Start  | --> | Decision ? |
+--------+     +------------+
                   |    |
                 Yes    No
                   |    |
          +---------+  +------+
          | Continue|  | Stop |
          +---------+  +------+

(Exact output depends on terminal width and diagram complexity.)


Supported diagram types

Currently supported or in progress:

  • Flowcharts
  • Sequence diagrams
  • Class diagrams
  • State diagrams

Unsupported constructs are ignored gracefully.


Python usage

You can also use the renderer programmatically:

from mermaid_ascii import render

ascii_diagram = render("""
flowchart LR
  A --> B
""")

print(ascii_diagram)

Project status

This project is actively developed and focused on:

  • Correct ASCII layout
  • Predictable rendering
  • Minimal dependencies
  • Mermaid syntax compatibility

Expect improvements rather than breaking changes.


License

MIT License
Copyright © 2025


Contributing

Issues and pull requests are welcome.

If you’re adding:

  • New diagram types
  • Layout improvements
  • CLI features

please include before/after ASCII output examples.


Why this exists

Mermaid is excellent — but not every environment can render SVGs or HTML.

mermaid-ascii-diagrams exists so diagrams remain readable everywhere.

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

mermaid_ascii_diagrams-0.1.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

mermaid_ascii_diagrams-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file mermaid_ascii_diagrams-0.1.0.tar.gz.

File metadata

  • Download URL: mermaid_ascii_diagrams-0.1.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mermaid_ascii_diagrams-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ccfbf6938fa7409daea7d0c1cf6775902e368b94d11e03d63d763e56d2021c6
MD5 b81611004b2eef1f96d8fedad391d3d7
BLAKE2b-256 2699f1912fcaf2c0280043d909db69c08bfcf9d2b61bb798fca7444689e9a701

See more details on using hashes here.

File details

Details for the file mermaid_ascii_diagrams-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mermaid_ascii_diagrams-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e7bf70435ef4ea38b465f17e941ad4e537569e502e9d5e1bbafd31bd3a37ef3
MD5 f9d7e038fa08bd04faa702218fedf5af
BLAKE2b-256 fad755f8e11a5cd250da1bedd74e496ead281f1907b77119b333aed872b2afe4

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