diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md
index 6e6703812..4086e8759 100644
--- a/ci/release/changelogs/next.md
+++ b/ci/release/changelogs/next.md
@@ -16,3 +16,4 @@
- Fixes `d2` erroring on malformed user paths (`fdopendir` error). [util-go#10](https://github.com/terrastruct/util-go/pull/10)
- Arrowhead labels being set without maps wasn't being picked up. [#1015](https://github.com/terrastruct/d2/pull/1015)
+- Fixes a dagre layout error with connections to a container shape with a block type label. [#1032](https://github.com/terrastruct/d2/pull/1032)
diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go
index 3683051d6..dec8c164e 100644
--- a/d2layouts/d2dagrelayout/layout.go
+++ b/d2layouts/d2dagrelayout/layout.go
@@ -467,7 +467,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
// if an edge to a container runs into its label, stop the edge at the label instead
overlapsContainerLabel := false
- if edge.Dst.IsContainer() && edge.Dst.Attributes.Label.Value != "" {
+ if edge.Dst.IsContainer() && edge.Dst.Attributes.Label.Value != "" && !dstShape.Is(shape.TEXT_TYPE) {
// assumes LabelPosition, LabelWidth, LabelHeight are all set if there is a label
labelWidth := float64(*edge.Dst.LabelWidth)
labelHeight := float64(*edge.Dst.LabelHeight)
diff --git a/e2etests/testdata/todo/dagre_container_md_label_panic/dagre/board.exp.json b/e2etests/testdata/todo/dagre_container_md_label_panic/dagre/board.exp.json
new file mode 100644
index 000000000..d9a322df0
--- /dev/null
+++ b/e2etests/testdata/todo/dagre_container_md_label_panic/dagre/board.exp.json
@@ -0,0 +1,697 @@
+{
+ "name": "",
+ "isFolderOnly": false,
+ "fontFamily": "SourceSansPro",
+ "shapes": [
+ {
+ "id": "OEM Factory",
+ "type": "rectangle",
+ "pos": {
+ "x": 77,
+ "y": 0
+ },
+ "width": 135,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B6",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "OEM Factory",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 90,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1
+ },
+ {
+ "id": "company Warehouse",
+ "type": "text",
+ "pos": {
+ "x": 0,
+ "y": 166
+ },
+ "width": 353,
+ "height": 664,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "transparent",
+ "stroke": "N1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "### company Warehouse\n- Asset Tagging\n- Inventory\n- Staging\n- Dispatch to Site",
+ "fontSize": 28,
+ "fontFamily": "DEFAULT",
+ "language": "markdown",
+ "color": "N1",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 184,
+ "labelHeight": 150,
+ "zIndex": 0,
+ "level": 1
+ },
+ {
+ "id": "company Warehouse.Master",
+ "type": "rectangle",
+ "pos": {
+ "x": 97,
+ "y": 216
+ },
+ "width": 94,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Master",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 49,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ },
+ {
+ "id": "company Warehouse.Regional-1",
+ "type": "rectangle",
+ "pos": {
+ "x": 194,
+ "y": 382
+ },
+ "width": 120,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Regional-1",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 75,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ },
+ {
+ "id": "company Warehouse.Regional-2",
+ "type": "rectangle",
+ "pos": {
+ "x": 94,
+ "y": 548
+ },
+ "width": 120,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Regional-2",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 75,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ },
+ {
+ "id": "company Warehouse.Regional-N",
+ "type": "rectangle",
+ "pos": {
+ "x": 93,
+ "y": 714
+ },
+ "width": 122,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Regional-N",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 77,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ }
+ ],
+ "connections": [
+ {
+ "id": "(OEM Factory -> company Warehouse)[0]",
+ "src": "OEM Factory",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 144,
+ "y": 66
+ },
+ {
+ "x": 144,
+ "y": 106
+ },
+ {
+ "x": 144,
+ "y": 126
+ },
+ {
+ "x": 144,
+ "y": 166
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Master -> Regional-1)[0]",
+ "src": "company Warehouse.Master",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-1",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 187.53614457831327,
+ "y": 282
+ },
+ {
+ "x": 240.30722891566265,
+ "y": 322
+ },
+ {
+ "x": 253.5,
+ "y": 342
+ },
+ {
+ "x": 253.5,
+ "y": 382
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Master -> Regional-2)[0]",
+ "src": "company Warehouse.Master",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-2",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 141.01807228915663,
+ "y": 282
+ },
+ {
+ "x": 137.40361445783134,
+ "y": 322
+ },
+ {
+ "x": 136.5,
+ "y": 348.6
+ },
+ {
+ "x": 136.5,
+ "y": 373.5
+ },
+ {
+ "x": 136.5,
+ "y": 398.4
+ },
+ {
+ "x": 138.5,
+ "y": 508
+ },
+ {
+ "x": 146.5,
+ "y": 548
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Master -> Regional-N)[0]",
+ "src": "company Warehouse.Master",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-N",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 108.01807228915663,
+ "y": 282
+ },
+ {
+ "x": 64.40361445783132,
+ "y": 322
+ },
+ {
+ "x": 53.5,
+ "y": 348.6
+ },
+ {
+ "x": 53.5,
+ "y": 373.5
+ },
+ {
+ "x": 53.5,
+ "y": 398.4
+ },
+ {
+ "x": 53.5,
+ "y": 431.6
+ },
+ {
+ "x": 53.5,
+ "y": 456.5
+ },
+ {
+ "x": 53.5,
+ "y": 481.4
+ },
+ {
+ "x": 53.5,
+ "y": 514.6
+ },
+ {
+ "x": 53.5,
+ "y": 539.5
+ },
+ {
+ "x": 53.5,
+ "y": 564.4
+ },
+ {
+ "x": 65.5,
+ "y": 674
+ },
+ {
+ "x": 113.5,
+ "y": 714
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Regional-1 -> Regional-2)[0]",
+ "src": "company Warehouse.Regional-1",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-2",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 233.62048192771084,
+ "y": 448
+ },
+ {
+ "x": 209.52409638554218,
+ "y": 488
+ },
+ {
+ "x": 197.5,
+ "y": 508
+ },
+ {
+ "x": 173.5,
+ "y": 548
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Regional-2 -> Regional-N)[0]",
+ "src": "company Warehouse.Regional-2",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-N",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 153.5,
+ "y": 614
+ },
+ {
+ "x": 153.5,
+ "y": 654
+ },
+ {
+ "x": 153.5,
+ "y": 674
+ },
+ {
+ "x": 153.5,
+ "y": 714
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Regional-N -> Regional-1)[0]",
+ "src": "company Warehouse.Regional-N",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-1",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 209.16265060240966,
+ "y": 714
+ },
+ {
+ "x": 276.63253012048193,
+ "y": 674
+ },
+ {
+ "x": 293.5,
+ "y": 647.4
+ },
+ {
+ "x": 293.5,
+ "y": 622.5
+ },
+ {
+ "x": 293.5,
+ "y": 597.6
+ },
+ {
+ "x": 288.7,
+ "y": 488
+ },
+ {
+ "x": 269.5,
+ "y": 448
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ }
+ ],
+ "root": {
+ "id": "",
+ "type": "",
+ "pos": {
+ "x": 0,
+ "y": 0
+ },
+ "width": 0,
+ "height": 0,
+ "opacity": 0,
+ "strokeDash": 0,
+ "strokeWidth": 0,
+ "borderRadius": 0,
+ "fill": "N7",
+ "stroke": "",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "",
+ "fontSize": 0,
+ "fontFamily": "",
+ "language": "",
+ "color": "",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "zIndex": 0,
+ "level": 0
+ }
+}
diff --git a/e2etests/testdata/todo/dagre_container_md_label_panic/dagre/sketch.exp.svg b/e2etests/testdata/todo/dagre_container_md_label_panic/dagre/sketch.exp.svg
new file mode 100644
index 000000000..66955e8f5
--- /dev/null
+++ b/e2etests/testdata/todo/dagre_container_md_label_panic/dagre/sketch.exp.svg
@@ -0,0 +1,851 @@
+
\ No newline at end of file
diff --git a/e2etests/testdata/todo/dagre_container_md_label_panic/elk/board.exp.json b/e2etests/testdata/todo/dagre_container_md_label_panic/elk/board.exp.json
new file mode 100644
index 000000000..9d37683b7
--- /dev/null
+++ b/e2etests/testdata/todo/dagre_container_md_label_panic/elk/board.exp.json
@@ -0,0 +1,622 @@
+{
+ "name": "",
+ "isFolderOnly": false,
+ "fontFamily": "SourceSansPro",
+ "shapes": [
+ {
+ "id": "OEM Factory",
+ "type": "rectangle",
+ "pos": {
+ "x": 115,
+ "y": 12
+ },
+ "width": 135,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B6",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "OEM Factory",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 90,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1
+ },
+ {
+ "id": "company Warehouse",
+ "type": "text",
+ "pos": {
+ "x": 12,
+ "y": 148
+ },
+ "width": 342,
+ "height": 604,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "transparent",
+ "stroke": "N1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "### company Warehouse\n- Asset Tagging\n- Inventory\n- Staging\n- Dispatch to Site",
+ "fontSize": 28,
+ "fontFamily": "DEFAULT",
+ "language": "markdown",
+ "color": "N1",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 184,
+ "labelHeight": 150,
+ "zIndex": 0,
+ "level": 1
+ },
+ {
+ "id": "company Warehouse.Master",
+ "type": "rectangle",
+ "pos": {
+ "x": 162,
+ "y": 198
+ },
+ "width": 120,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Master",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 49,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ },
+ {
+ "id": "company Warehouse.Regional-1",
+ "type": "rectangle",
+ "pos": {
+ "x": 62,
+ "y": 344
+ },
+ "width": 120,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Regional-1",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 75,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ },
+ {
+ "id": "company Warehouse.Regional-2",
+ "type": "rectangle",
+ "pos": {
+ "x": 143,
+ "y": 490
+ },
+ "width": 120,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Regional-2",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 75,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ },
+ {
+ "id": "company Warehouse.Regional-N",
+ "type": "rectangle",
+ "pos": {
+ "x": 142,
+ "y": 636
+ },
+ "width": 122,
+ "height": 66,
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "borderRadius": 0,
+ "fill": "B5",
+ "stroke": "B1",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "Regional-N",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 77,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 2
+ }
+ ],
+ "connections": [
+ {
+ "id": "(OEM Factory -> company Warehouse)[0]",
+ "src": "OEM Factory",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 183,
+ "y": 78
+ },
+ {
+ "x": 183,
+ "y": 148
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Master -> Regional-1)[0]",
+ "src": "company Warehouse.Master",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-1",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 192.75,
+ "y": 264
+ },
+ {
+ "x": 192.75,
+ "y": 304
+ },
+ {
+ "x": 122,
+ "y": 304
+ },
+ {
+ "x": 122,
+ "y": 344
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Master -> Regional-2)[0]",
+ "src": "company Warehouse.Master",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-2",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 222.75,
+ "y": 264
+ },
+ {
+ "x": 222.75,
+ "y": 304
+ },
+ {
+ "x": 223,
+ "y": 304
+ },
+ {
+ "x": 223,
+ "y": 490
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Master -> Regional-N)[0]",
+ "src": "company Warehouse.Master",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-N",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 252.75,
+ "y": 264
+ },
+ {
+ "x": 252.75,
+ "y": 304
+ },
+ {
+ "x": 303,
+ "y": 304
+ },
+ {
+ "x": 303,
+ "y": 596
+ },
+ {
+ "x": 233.5,
+ "y": 596
+ },
+ {
+ "x": 233.5,
+ "y": 636
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Regional-1 -> Regional-2)[0]",
+ "src": "company Warehouse.Regional-1",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-2",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 142,
+ "y": 410
+ },
+ {
+ "x": 142,
+ "y": 450
+ },
+ {
+ "x": 183,
+ "y": 450
+ },
+ {
+ "x": 183,
+ "y": 490
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Regional-2 -> Regional-N)[0]",
+ "src": "company Warehouse.Regional-2",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-N",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 203,
+ "y": 556
+ },
+ {
+ "x": 203,
+ "y": 636
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "company Warehouse.(Regional-N -> Regional-1)[0]",
+ "src": "company Warehouse.Regional-N",
+ "srcArrow": "none",
+ "srcLabel": "",
+ "dst": "company Warehouse.Regional-1",
+ "dstArrow": "triangle",
+ "dstLabel": "",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "labelPosition": "",
+ "labelPercentage": 0,
+ "route": [
+ {
+ "x": 172.5,
+ "y": 636
+ },
+ {
+ "x": 172.5,
+ "y": 596
+ },
+ {
+ "x": 102,
+ "y": 596
+ },
+ {
+ "x": 102,
+ "y": 410
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ }
+ ],
+ "root": {
+ "id": "",
+ "type": "",
+ "pos": {
+ "x": 0,
+ "y": 0
+ },
+ "width": 0,
+ "height": 0,
+ "opacity": 0,
+ "strokeDash": 0,
+ "strokeWidth": 0,
+ "borderRadius": 0,
+ "fill": "N7",
+ "stroke": "",
+ "shadow": false,
+ "3d": false,
+ "multiple": false,
+ "double-border": false,
+ "tooltip": "",
+ "link": "",
+ "icon": null,
+ "iconPosition": "",
+ "blend": false,
+ "fields": null,
+ "methods": null,
+ "columns": null,
+ "label": "",
+ "fontSize": 0,
+ "fontFamily": "",
+ "language": "",
+ "color": "",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "zIndex": 0,
+ "level": 0
+ }
+}
diff --git a/e2etests/testdata/todo/dagre_container_md_label_panic/elk/sketch.exp.svg b/e2etests/testdata/todo/dagre_container_md_label_panic/elk/sketch.exp.svg
new file mode 100644
index 000000000..29712be07
--- /dev/null
+++ b/e2etests/testdata/todo/dagre_container_md_label_panic/elk/sketch.exp.svg
@@ -0,0 +1,851 @@
+OEM Factorycompany Warehouse
+
+- Asset Tagging
+- Inventory
+- Staging
+- Dispatch to Site
+
+
MasterRegional-1Regional-2Regional-N
+
+
+
\ No newline at end of file
diff --git a/e2etests/todo_test.go b/e2etests/todo_test.go
index 24b52e03d..232db0b66 100644
--- a/e2etests/todo_test.go
+++ b/e2etests/todo_test.go
@@ -251,6 +251,27 @@ x -> y: {
}
y: bar {z}
+`,
+ },
+ {
+ name: "dagre_container_md_label_panic",
+ script: `
+OEM Factory -> company Warehouse
+
+company Warehouse.Master -> company Warehouse.Regional-1
+company Warehouse.Master -> company Warehouse.Regional-2
+company Warehouse.Master -> company Warehouse.Regional-N
+company Warehouse.Regional-1 -> company Warehouse.Regional-2
+company Warehouse.Regional-2 -> company Warehouse.Regional-N
+company Warehouse.Regional-N -> company Warehouse.Regional-1
+
+company Warehouse: |md
+ ### company Warehouse
+ - Asset Tagging
+ - Inventory
+ - Staging
+ - Dispatch to Site
+|
`,
},
}