Dynnammo / python_mermaid

GNU General Public License v3.0
30 stars 9 forks source link

The `hexagon` node shape is not rendered properly #32

Open philiporlando opened 2 months ago

philiporlando commented 2 months ago

This reprex shows that shape = "hexagon" is translating to Mermaid as {{)} instead of {{}}, which results in a rendering error:

from python_mermaid.diagram import Link, MermaidDiagram, Node

# Family members
meg = Node("Meg", shape="hexagon")
jo = Node("Jo")
beth = Node("Beth")
amy = Node("Amy")
robert = Node("Robert March")

the_march_family = [meg, jo, beth, amy, robert]

# Create links
family_links = [
    Link(robert, meg),
    Link(robert, jo),
    Link(robert, beth),
    Link(robert, amy),
]

chart = MermaidDiagram(title="Little Women", nodes=the_march_family, links=family_links)

print(chart)
---
title: Little Women
---
graph
meg{{"Meg")}       
jo["Jo"]
beth["Beth"]       
amy["Amy"]
robert_march["Robert March"]
robert_march ---> meg
robert_march ---> jo
robert_march ---> beth
robert_march ---> amy
Dynnammo commented 2 months ago

Nice catch ! If you have the time to investigate the bug, I'll be happy to let you do a PR to correct it, as I'm not actively correcting bugs as of now.