MCPcopy Create free account
hub / github.com/Effect-TS/effect / formatMermaidNode

Function formatMermaidNode

packages/effect/src/Graph.ts:3186–3211  ·  view source on GitHub ↗
(
  nodeId: string,
  label: string,
  shape: MermaidNodeShape
)

Source from the content-addressed store, hash-verified

3184 * Formats a Mermaid node with the specified shape and label.
3185 */
3186const formatMermaidNode = (
3187 nodeId: string,
3188 label: string,
3189 shape: MermaidNodeShape
3190): string => {
3191 switch (shape) {
3192 case "rectangle":
3193 return `${nodeId}["${label}"]`
3194 case "rounded":
3195 return `${nodeId}("${label}")`
3196 case "circle":
3197 return `${nodeId}(("${label}"))`
3198 case "diamond":
3199 return `${nodeId}{"${label}"}`
3200 case "hexagon":
3201 return `${nodeId}{{"${label}"}}`
3202 case "stadium":
3203 return `${nodeId}(["${label}"])`
3204 case "subroutine":
3205 return `${nodeId}[["${label}"]]`
3206 case "cylindrical":
3207 return `${nodeId}[("${label}")]`
3208 default:
3209 return `${nodeId}["${label}"]` // Default rectangle
3210 }
3211}
3212
3213/**
3214 * Exports a graph to Mermaid diagram format for visualization.

Callers 1

Graph.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected