@@ -15,16 +15,20 @@ const (
15
15
)
16
16
17
17
var (
18
- MermaidShapeRound = shape {"(" , ")" }
19
- MermaidShapeStadium = shape {"([" , "])" }
20
- MermaidShapeSubroutine = shape {"[[" , "]]" }
21
- MermaidShapeCylinder = shape {"[(" , ")]" }
22
- MermaidShapeCirle = shape {"((" , "))" } // Deprecated: use MermaidShapeCircle instead
23
- MermaidShapeCircle = shape {"((" , "))" }
24
- MermaidShapeAsymmetric = shape {">" , "]" }
25
- MermaidShapeRhombus = shape {"{" , "}" }
26
- MermaidShapeTrapezoid = shape {"[/" , "\\ ]" }
27
- MermaidShapeTrapezoidAlt = shape {"[\\ " , "/]" }
18
+ MermaidShapeRound = shape {"(" , ")" }
19
+ MermaidShapeStadium = shape {"([" , "])" }
20
+ MermaidShapeSubroutine = shape {"[[" , "]]" }
21
+ MermaidShapeCylinder = shape {"[(" , ")]" }
22
+ MermaidShapeCirle = shape {"((" , "))" } // Deprecated: use MermaidShapeCircle instead
23
+ MermaidShapeCircle = shape {"((" , "))" }
24
+ MermaidShapeAsymmetric = shape {">" , "]" }
25
+ MermaidShapeRhombus = shape {"{" , "}" }
26
+ MermaidShapeTrapezoid = shape {"[/" , "\\ ]" }
27
+ MermaidShapeTrapezoidAlt = shape {"[\\ " , "/]" }
28
+ MermaidShapeHexagon = shape {"[{{" , "}}]" }
29
+ MermaidShapeParallelogram = shape {"[/" , "/]" }
30
+ MermaidShapeParallelogramAlt = shape {"[\\ " , "\\ ]" }
31
+ // TODO more shapes see https://mermaid.js.org/syntax/flowchart.html#node-shapes
28
32
)
29
33
30
34
type shape struct {
@@ -96,10 +100,15 @@ func diagramGraph(g *Graph, sb *strings.Builder) {
96
100
for _ , each := range g .sortedEdgesFromKeys () {
97
101
all := g .edgesFrom [each ]
98
102
for _ , each := range all {
103
+ // The edge can override the link style
104
+ link := denoteEdge
105
+ if l := each .GetAttr ("link" ); l != nil {
106
+ link = l .(string )
107
+ }
99
108
if label := each .GetAttr ("label" ); label != nil {
100
- fmt .Fprintf (sb , "\t n%d%s|%s|n%d;\n " , each .from .seq , denoteEdge , escape (label .(string )), each .to .seq )
109
+ fmt .Fprintf (sb , "\t n%d%s|%s|n%d;\n " , each .from .seq , link , escape (label .(string )), each .to .seq )
101
110
} else {
102
- fmt .Fprintf (sb , "\t n%d%sn%d;\n " , each .from .seq , denoteEdge , each .to .seq )
111
+ fmt .Fprintf (sb , "\t n%d%sn%d;\n " , each .from .seq , link , each .to .seq )
103
112
}
104
113
}
105
114
}
0 commit comments