dot2mermaid
A library for converting dot file to mermaid and markdown.
Requirements:
- graphviz
- code2flow
- pygraphviz
Windows users should install pygraphviz after graphviz by:
py -m pip install --use-pep517 --config-settings="--global-option=build_ext" --config-settings="--global-option=-IC:\Program Files\Graphviz\include" --config-settings="--global-option=-LC:\Program Files\Graphviz\lib" pygraphviz
After proper installation, try:
from dot2mermaid import DotParser, get_dot
path = "./path/to/your/code/directory"
dot_file = get_dot(path)
parser = DotParser(dot_file)
colors = {
'regular': '#555555',
'trunk': '#AA5555',
'leaf': '#5555FF'
}
markdown_content = parser.to_mermaid(colors=colors)
parser.add_to_markdown('./README.md', markdown_content) # to replace mermaid
graph LR
%% Subgraphs
subgraph File: dot2mermaid
direction LR
subgraph Class: DotParser
direction LR
node_e87307ce["62: _parse_legend_colors()"]:::leaf
node_4ae5ed1a["44: _parse_subgraphs()"]:::filled
node_9e04e6af["151: add_to_markdown()"]:::trunk
node_1435b8f8["130: create_node_style()"]:::leaf
node_ba5c8ee4["119: edges_to_mermaid()"]:::filled
node_6fed536c["77: get_edges()"]:::leaf
node_c9b26d7f["74: get_subgraphs()"]:::filled
node_4c63ab74["91: subgraphs_to_mermaid()"]:::filled
node_c0357d7b["137: to_mermaid()"]:::trunk
end
node_e87307ce["62: _parse_legend_colors()"]:::leaf
node_4ae5ed1a["44: _parse_subgraphs()"]:::filled
node_9e04e6af["151: add_to_markdown()"]:::trunk
node_1435b8f8["130: create_node_style()"]:::leaf
node_ba5c8ee4["119: edges_to_mermaid()"]:::filled
node_6fed536c["77: get_edges()"]:::leaf
node_c9b26d7f["74: get_subgraphs()"]:::filled
node_4c63ab74["91: subgraphs_to_mermaid()"]:::filled
node_c0357d7b["137: to_mermaid()"]:::trunk
node_3a20c0f3["20: get_dot()"]:::trunk
node_98f88cb0["9: read()"]:::leaf
node_ec40940c["15: save()"]:::leaf
end
%% Edges
node_4ae5ed1a --> node_e87307ce
node_4ae5ed1a --> node_4ae5ed1a
node_9e04e6af --> node_98f88cb0
node_9e04e6af --> node_ec40940c
node_ba5c8ee4 --> node_6fed536c
node_c9b26d7f --> node_4ae5ed1a
node_4c63ab74 --> node_c9b26d7f
node_c0357d7b --> node_1435b8f8
node_c0357d7b --> node_ba5c8ee4
node_c0357d7b --> node_4c63ab74
node_3a20c0f3 --> node_98f88cb0
%% Edge styles
linkStyle 0 stroke:#56B4E9
linkStyle 1 stroke:#56B4E9
linkStyle 2 stroke:#CC79A7
linkStyle 3 stroke:#CC79A7
linkStyle 4 stroke:#F0E442
linkStyle 5 stroke:#CC79A7
linkStyle 6 stroke:#F0E442
linkStyle 7 stroke:#009E73
linkStyle 8 stroke:#009E73
linkStyle 9 stroke:#009E73
linkStyle 10 stroke:#009E73
%% Node styles
classDef filled fill:#555555,stroke:#000000,stroke-width:2px;
classDef leaf fill:#5555FF,stroke:#000000,stroke-width:2px;
classDef trunk fill:#AA5555,stroke:#000000,stroke-width:2px;
Compare it with code2flow png file:
Metadata
Release files for dot2mermaid 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dot2mermaid-0.3.0.tar.gz | 4.4 kB | Without provenance | Details for dot2mermaid-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dot2mermaid-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for dot2mermaid-0.3.0-py3-none-any.whl |
Total release size: 9.3 kB
Release files / dot2mermaid-0.3.0.tar.gz
| Download URL | dot2mermaid-0.3.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e1c7c1e2b26ba50894858c4ff7e5872ad32b73dbfc064b8f460ce919229fe88
|
|
BLAKE2b-256 checksum How to use checksums |
55c48bc9200574d68456e2ffbf4a3de64b223d689e13b1710be3dd7650826380
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.6 Windows/10
|
Release files / dot2mermaid-0.3.0-py3-none-any.whl
| Download URL | dot2mermaid-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64fd4c2d935069a7211f574c1ae08143e9c403f9e1a526e313cc93b7f8d93b6f
|
|
BLAKE2b-256 checksum How to use checksums |
b0cdf7b3592f64002b51ca17467bd67a18e14036c8856d0b38e258b3bee35bf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.6 Windows/10
|
Security for dot2mermaid 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.