From 83ca32e4bf963e2205cb24f4b83bed8048986afe Mon Sep 17 00:00:00 2001
From: Daniel Suh <23denial@gmail.com>
Date: Wed, 29 May 2024 21:05:52 -0400
Subject: [PATCH] link on connections are now labels
---
ci/release/changelogs/next.md | 6 +
d2graph/d2graph.go | 6 +-
d2renderers/d2svg/d2svg.go | 20 +-
d2target/d2target.go | 3 +-
.../link-on-connections/dagre/board.exp.json | 219 ++++++++++++++++--
.../link-on-connections/dagre/sketch.exp.svg | 208 +++++++++--------
.../link-on-connections/elk/board.exp.json | 200 ++++++++++++++--
.../link-on-connections/elk/sketch.exp.svg | 208 +++++++++--------
e2etests/txtar.txt | 14 +-
9 files changed, 645 insertions(+), 239 deletions(-)
diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md
index ccf98bf1f..02455ed2e 100644
--- a/ci/release/changelogs/next.md
+++ b/ci/release/changelogs/next.md
@@ -1,4 +1,5 @@
#### Features 🚀
+- Connections now support `link` in SVGs [#1955](https://github.com/terrastruct/d2/pull/1955)
- Vars: vars in markdown blocks are substituted [#2218](https://github.com/terrastruct/d2/pull/2218)
- Markdown: Github-flavored tables work in `md` blocks [#2221](https://github.com/terrastruct/d2/pull/2221)
@@ -32,8 +33,13 @@
- Sequence diagram: the padding between message labels and message endpoints are slightly increased [#2096](https://github.com/terrastruct/d2/pull/2096)
- Opacity 0 shapes no longer have a label mask which made any segment of connections going through them lower opacity [#1940](https://github.com/terrastruct/d2/pull/1940)
- Bidirectional connections are now animated in opposite directions rather than one direction [#1939](https://github.com/terrastruct/d2/pull/1939)
+<<<<<<< HEAD
- Connections now support `link` in SVGs [#1955](https://github.com/terrastruct/d2/pull/1955)
>>>>>>> 703bcd388 (update next.md)
+||||||| parent of ba86dc990 (link on connections are now labels)
+- Connections now support `link` in SVGs [#1955](https://github.com/terrastruct/d2/pull/1955)
+=======
+>>>>>>> ba86dc990 (link on connections are now labels)
#### Bugfixes ⛑️
diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go
index 0776849ab..6ea978510 100644
--- a/d2graph/d2graph.go
+++ b/d2graph/d2graph.go
@@ -1620,7 +1620,11 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler
obj.SizeToContent(contentBox.Width, contentBox.Height, paddingX, paddingY)
}
- for _, edge := range g.Edges {
+ for i, edge := range g.Edges {
+ if edge.Link != nil {
+ g.Edges[i].Label.Value = edge.Link.Value
+ }
+
usedFont := fontFamily
if edge.Style.Font != nil {
f := d2fonts.D2_FONT_TO_FAMILY[edge.Style.Font.Value]
diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go
index 31cf4f439..ebe65a5aa 100644
--- a/d2renderers/d2svg/d2svg.go
+++ b/d2renderers/d2svg/d2svg.go
@@ -502,13 +502,6 @@ func drawConnection(writer io.Writer, labelMaskID string, connection d2target.Co
opacityStyle = fmt.Sprintf(" style='opacity:%f'", connection.Opacity)
}
- closingTag := ""
- if connection.Link != "" {
- fmt.Fprintf(writer, ``, svg.EscapeText(connection.Link))
- fmt.Println("Hello")
- closingTag += ""
- }
-
classStr := ""
if len(connection.Classes) > 0 {
classStr = fmt.Sprintf(` class="%s"`, strings.Join(connection.Classes, " "))
@@ -646,7 +639,19 @@ func drawConnection(writer io.Writer, labelMaskID string, connection d2target.Co
textEl.ClassName = fontClass
textEl.Style = fmt.Sprintf("text-anchor:%s;font-size:%vpx", "middle", connection.FontSize)
textEl.Content = RenderText(connection.Label, textEl.X, float64(connection.LabelHeight))
+
+ if connection.Link != "" {
+ textEl.Fill = "blue"
+ textEl.ClassName += " text-underline"
+
+ fmt.Fprintf(writer, ``, svg.EscapeText(connection.Link))
+ }
+
fmt.Fprint(writer, textEl.Render())
+
+ if connection.Link != "" {
+ fmt.Fprintf(writer, "")
+ }
}
if connection.SrcLabel != nil && connection.SrcLabel.Label != "" {
@@ -656,7 +661,6 @@ func drawConnection(writer io.Writer, labelMaskID string, connection d2target.Co
fmt.Fprint(writer, renderArrowheadLabel(connection, connection.DstLabel.Label, true, inlineTheme))
}
fmt.Fprintf(writer, ``)
- fmt.Fprintf(writer, "%s", closingTag)
return
}
diff --git a/d2target/d2target.go b/d2target/d2target.go
index 4f6046f5e..a2c6d680d 100644
--- a/d2target/d2target.go
+++ b/d2target/d2target.go
@@ -599,7 +599,8 @@ type Connection struct {
LabelPosition string `json:"labelPosition"`
LabelPercentage float64 `json:"labelPercentage"`
- Link string `json:"link"`
+ Link string `json:"link"`
+ PrettyLink string `json:"prettyLink,omitempty"`
Route []*geo.Point `json:"route"`
IsCurve bool `json:"isCurve,omitempty"`
diff --git a/e2etests/testdata/txtar/link-on-connections/dagre/board.exp.json b/e2etests/testdata/txtar/link-on-connections/dagre/board.exp.json
index 891afd24f..464563f1a 100644
--- a/e2etests/testdata/txtar/link-on-connections/dagre/board.exp.json
+++ b/e2etests/testdata/txtar/link-on-connections/dagre/board.exp.json
@@ -7,10 +7,10 @@
"id": "a",
"type": "rectangle",
"pos": {
- "x": 0,
+ "x": 40,
"y": 0
},
- "width": 85,
+ "width": 53,
"height": 66,
"opacity": 1,
"strokeDash": 0,
@@ -23,8 +23,7 @@
"multiple": false,
"double-border": false,
"tooltip": "",
- "link": "https://twitter.com",
- "prettyLink": "https://twitter.com",
+ "link": "",
"icon": null,
"iconPosition": "",
"blend": false,
@@ -49,8 +48,8 @@
"id": "b",
"type": "rectangle",
"pos": {
- "x": 16,
- "y": 166
+ "x": 40,
+ "y": 187
},
"width": 53,
"height": 66,
@@ -85,6 +84,47 @@
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
+ },
+ {
+ "id": "c",
+ "type": "rectangle",
+ "pos": {
+ "x": 40,
+ "y": 374
+ },
+ "width": 53,
+ "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": "c",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 8,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1
}
],
"connections": [
@@ -99,7 +139,7 @@
"strokeWidth": 2,
"stroke": "B1",
"borderRadius": 10,
- "label": "",
+ "label": "https://google.com/",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
@@ -107,27 +147,75 @@
"italic": true,
"bold": false,
"underline": false,
- "labelWidth": 0,
- "labelHeight": 0,
- "labelPosition": "",
+ "labelWidth": 133,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
"labelPercentage": 0,
- "link": "https://google.com",
+ "link": "https://google.com/",
"route": [
{
- "x": 42.5,
- "y": 66
+ "x": 66.5,
+ "y": 65.5
},
{
- "x": 42.5,
- "y": 106
+ "x": 66.5,
+ "y": 114.30000305175781
},
{
- "x": 42.5,
- "y": 126
+ "x": 66.5,
+ "y": 138.6999969482422
},
{
- "x": 42.5,
- "y": 166
+ "x": 66.5,
+ "y": 187.5
+ }
+ ],
+ "isCurve": true,
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "(b -> c)[0]",
+ "src": "b",
+ "srcArrow": "none",
+ "dst": "c",
+ "dstArrow": "triangle",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "root.layers.d",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 84,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPercentage": 0,
+ "link": "root.layers.d",
+ "route": [
+ {
+ "x": 66.5,
+ "y": 252.5
+ },
+ {
+ "x": 66.5,
+ "y": 301.29998779296875
+ },
+ {
+ "x": 66.5,
+ "y": 325.70001220703125
+ },
+ {
+ "x": 66.5,
+ "y": 374.5
}
],
"isCurve": true,
@@ -176,5 +264,96 @@
"labelHeight": 0,
"zIndex": 0,
"level": 0
- }
+ },
+ "layers": [
+ {
+ "name": "d",
+ "isFolderOnly": false,
+ "fontFamily": "SourceSansPro",
+ "shapes": [
+ {
+ "id": "d",
+ "type": "rectangle",
+ "pos": {
+ "x": 0,
+ "y": 0
+ },
+ "width": 54,
+ "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": "d",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 9,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1
+ }
+ ],
+ "connections": [],
+ "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": "d",
+ "fontSize": 0,
+ "fontFamily": "",
+ "language": "",
+ "color": "",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "zIndex": 0,
+ "level": 0
+ }
+ }
+ ]
}
diff --git a/e2etests/testdata/txtar/link-on-connections/dagre/sketch.exp.svg b/e2etests/testdata/txtar/link-on-connections/dagre/sketch.exp.svg
index 773f203ee..e42f6316c 100644
--- a/e2etests/testdata/txtar/link-on-connections/dagre/sketch.exp.svg
+++ b/e2etests/testdata/txtar/link-on-connections/dagre/sketch.exp.svg
@@ -1,13 +1,20 @@
-
\ No newline at end of file
+ .d2-1855656159 .fill-N1{fill:#0A0F25;}
+ .d2-1855656159 .fill-N2{fill:#676C7E;}
+ .d2-1855656159 .fill-N3{fill:#9499AB;}
+ .d2-1855656159 .fill-N4{fill:#CFD2DD;}
+ .d2-1855656159 .fill-N5{fill:#DEE1EB;}
+ .d2-1855656159 .fill-N6{fill:#EEF1F8;}
+ .d2-1855656159 .fill-N7{fill:#FFFFFF;}
+ .d2-1855656159 .fill-B1{fill:#0D32B2;}
+ .d2-1855656159 .fill-B2{fill:#0D32B2;}
+ .d2-1855656159 .fill-B3{fill:#E3E9FD;}
+ .d2-1855656159 .fill-B4{fill:#E3E9FD;}
+ .d2-1855656159 .fill-B5{fill:#EDF0FD;}
+ .d2-1855656159 .fill-B6{fill:#F7F8FE;}
+ .d2-1855656159 .fill-AA2{fill:#4A6FF3;}
+ .d2-1855656159 .fill-AA4{fill:#EDF0FD;}
+ .d2-1855656159 .fill-AA5{fill:#F7F8FE;}
+ .d2-1855656159 .fill-AB4{fill:#EDF0FD;}
+ .d2-1855656159 .fill-AB5{fill:#F7F8FE;}
+ .d2-1855656159 .stroke-N1{stroke:#0A0F25;}
+ .d2-1855656159 .stroke-N2{stroke:#676C7E;}
+ .d2-1855656159 .stroke-N3{stroke:#9499AB;}
+ .d2-1855656159 .stroke-N4{stroke:#CFD2DD;}
+ .d2-1855656159 .stroke-N5{stroke:#DEE1EB;}
+ .d2-1855656159 .stroke-N6{stroke:#EEF1F8;}
+ .d2-1855656159 .stroke-N7{stroke:#FFFFFF;}
+ .d2-1855656159 .stroke-B1{stroke:#0D32B2;}
+ .d2-1855656159 .stroke-B2{stroke:#0D32B2;}
+ .d2-1855656159 .stroke-B3{stroke:#E3E9FD;}
+ .d2-1855656159 .stroke-B4{stroke:#E3E9FD;}
+ .d2-1855656159 .stroke-B5{stroke:#EDF0FD;}
+ .d2-1855656159 .stroke-B6{stroke:#F7F8FE;}
+ .d2-1855656159 .stroke-AA2{stroke:#4A6FF3;}
+ .d2-1855656159 .stroke-AA4{stroke:#EDF0FD;}
+ .d2-1855656159 .stroke-AA5{stroke:#F7F8FE;}
+ .d2-1855656159 .stroke-AB4{stroke:#EDF0FD;}
+ .d2-1855656159 .stroke-AB5{stroke:#F7F8FE;}
+ .d2-1855656159 .background-color-N1{background-color:#0A0F25;}
+ .d2-1855656159 .background-color-N2{background-color:#676C7E;}
+ .d2-1855656159 .background-color-N3{background-color:#9499AB;}
+ .d2-1855656159 .background-color-N4{background-color:#CFD2DD;}
+ .d2-1855656159 .background-color-N5{background-color:#DEE1EB;}
+ .d2-1855656159 .background-color-N6{background-color:#EEF1F8;}
+ .d2-1855656159 .background-color-N7{background-color:#FFFFFF;}
+ .d2-1855656159 .background-color-B1{background-color:#0D32B2;}
+ .d2-1855656159 .background-color-B2{background-color:#0D32B2;}
+ .d2-1855656159 .background-color-B3{background-color:#E3E9FD;}
+ .d2-1855656159 .background-color-B4{background-color:#E3E9FD;}
+ .d2-1855656159 .background-color-B5{background-color:#EDF0FD;}
+ .d2-1855656159 .background-color-B6{background-color:#F7F8FE;}
+ .d2-1855656159 .background-color-AA2{background-color:#4A6FF3;}
+ .d2-1855656159 .background-color-AA4{background-color:#EDF0FD;}
+ .d2-1855656159 .background-color-AA5{background-color:#F7F8FE;}
+ .d2-1855656159 .background-color-AB4{background-color:#EDF0FD;}
+ .d2-1855656159 .background-color-AB5{background-color:#F7F8FE;}
+ .d2-1855656159 .color-N1{color:#0A0F25;}
+ .d2-1855656159 .color-N2{color:#676C7E;}
+ .d2-1855656159 .color-N3{color:#9499AB;}
+ .d2-1855656159 .color-N4{color:#CFD2DD;}
+ .d2-1855656159 .color-N5{color:#DEE1EB;}
+ .d2-1855656159 .color-N6{color:#EEF1F8;}
+ .d2-1855656159 .color-N7{color:#FFFFFF;}
+ .d2-1855656159 .color-B1{color:#0D32B2;}
+ .d2-1855656159 .color-B2{color:#0D32B2;}
+ .d2-1855656159 .color-B3{color:#E3E9FD;}
+ .d2-1855656159 .color-B4{color:#E3E9FD;}
+ .d2-1855656159 .color-B5{color:#EDF0FD;}
+ .d2-1855656159 .color-B6{color:#F7F8FE;}
+ .d2-1855656159 .color-AA2{color:#4A6FF3;}
+ .d2-1855656159 .color-AA4{color:#EDF0FD;}
+ .d2-1855656159 .color-AA5{color:#F7F8FE;}
+ .d2-1855656159 .color-AB4{color:#EDF0FD;}
+ .d2-1855656159 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>abc https://google.com/root.layers.d
+
+
+
+
+
+
+d
+
+
+
\ No newline at end of file
diff --git a/e2etests/testdata/txtar/link-on-connections/elk/board.exp.json b/e2etests/testdata/txtar/link-on-connections/elk/board.exp.json
index a14d8bc25..5fa69103c 100644
--- a/e2etests/testdata/txtar/link-on-connections/elk/board.exp.json
+++ b/e2etests/testdata/txtar/link-on-connections/elk/board.exp.json
@@ -7,10 +7,10 @@
"id": "a",
"type": "rectangle",
"pos": {
- "x": 12,
+ "x": 52,
"y": 12
},
- "width": 85,
+ "width": 53,
"height": 66,
"opacity": 1,
"strokeDash": 0,
@@ -23,8 +23,7 @@
"multiple": false,
"double-border": false,
"tooltip": "",
- "link": "https://twitter.com",
- "prettyLink": "https://twitter.com",
+ "link": "",
"icon": null,
"iconPosition": "",
"blend": false,
@@ -49,8 +48,8 @@
"id": "b",
"type": "rectangle",
"pos": {
- "x": 28,
- "y": 148
+ "x": 52,
+ "y": 239
},
"width": 53,
"height": 66,
@@ -85,6 +84,47 @@
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
+ },
+ {
+ "id": "c",
+ "type": "rectangle",
+ "pos": {
+ "x": 52,
+ "y": 466
+ },
+ "width": 53,
+ "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": "c",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 8,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1
}
],
"connections": [
@@ -99,7 +139,7 @@
"strokeWidth": 2,
"stroke": "B1",
"borderRadius": 10,
- "label": "",
+ "label": "https://google.com/",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
@@ -107,19 +147,58 @@
"italic": true,
"bold": false,
"underline": false,
- "labelWidth": 0,
- "labelHeight": 0,
- "labelPosition": "",
+ "labelWidth": 133,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
"labelPercentage": 0,
- "link": "https://google.com",
+ "link": "https://google.com/",
"route": [
{
- "x": 54.5,
+ "x": 78.5,
"y": 78
},
{
- "x": 54.5,
- "y": 148
+ "x": 78.5,
+ "y": 239
+ }
+ ],
+ "animated": false,
+ "tooltip": "",
+ "icon": null,
+ "zIndex": 0
+ },
+ {
+ "id": "(b -> c)[0]",
+ "src": "b",
+ "srcArrow": "none",
+ "dst": "c",
+ "dstArrow": "triangle",
+ "opacity": 1,
+ "strokeDash": 0,
+ "strokeWidth": 2,
+ "stroke": "B1",
+ "borderRadius": 10,
+ "label": "root.layers.d",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N2",
+ "italic": true,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 84,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "labelPercentage": 0,
+ "link": "root.layers.d",
+ "route": [
+ {
+ "x": 78.5,
+ "y": 305
+ },
+ {
+ "x": 78.5,
+ "y": 466
}
],
"animated": false,
@@ -167,5 +246,96 @@
"labelHeight": 0,
"zIndex": 0,
"level": 0
- }
+ },
+ "layers": [
+ {
+ "name": "d",
+ "isFolderOnly": false,
+ "fontFamily": "SourceSansPro",
+ "shapes": [
+ {
+ "id": "d",
+ "type": "rectangle",
+ "pos": {
+ "x": 12,
+ "y": 12
+ },
+ "width": 54,
+ "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": "d",
+ "fontSize": 16,
+ "fontFamily": "DEFAULT",
+ "language": "",
+ "color": "N1",
+ "italic": false,
+ "bold": true,
+ "underline": false,
+ "labelWidth": 9,
+ "labelHeight": 21,
+ "labelPosition": "INSIDE_MIDDLE_CENTER",
+ "zIndex": 0,
+ "level": 1
+ }
+ ],
+ "connections": [],
+ "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": "d",
+ "fontSize": 0,
+ "fontFamily": "",
+ "language": "",
+ "color": "",
+ "italic": false,
+ "bold": false,
+ "underline": false,
+ "labelWidth": 0,
+ "labelHeight": 0,
+ "zIndex": 0,
+ "level": 0
+ }
+ }
+ ]
}
diff --git a/e2etests/testdata/txtar/link-on-connections/elk/sketch.exp.svg b/e2etests/testdata/txtar/link-on-connections/elk/sketch.exp.svg
index be19c62e0..ccfb2dd57 100644
--- a/e2etests/testdata/txtar/link-on-connections/elk/sketch.exp.svg
+++ b/e2etests/testdata/txtar/link-on-connections/elk/sketch.exp.svg
@@ -1,13 +1,20 @@
-ab
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+ .d2-4163031082 .fill-N1{fill:#0A0F25;}
+ .d2-4163031082 .fill-N2{fill:#676C7E;}
+ .d2-4163031082 .fill-N3{fill:#9499AB;}
+ .d2-4163031082 .fill-N4{fill:#CFD2DD;}
+ .d2-4163031082 .fill-N5{fill:#DEE1EB;}
+ .d2-4163031082 .fill-N6{fill:#EEF1F8;}
+ .d2-4163031082 .fill-N7{fill:#FFFFFF;}
+ .d2-4163031082 .fill-B1{fill:#0D32B2;}
+ .d2-4163031082 .fill-B2{fill:#0D32B2;}
+ .d2-4163031082 .fill-B3{fill:#E3E9FD;}
+ .d2-4163031082 .fill-B4{fill:#E3E9FD;}
+ .d2-4163031082 .fill-B5{fill:#EDF0FD;}
+ .d2-4163031082 .fill-B6{fill:#F7F8FE;}
+ .d2-4163031082 .fill-AA2{fill:#4A6FF3;}
+ .d2-4163031082 .fill-AA4{fill:#EDF0FD;}
+ .d2-4163031082 .fill-AA5{fill:#F7F8FE;}
+ .d2-4163031082 .fill-AB4{fill:#EDF0FD;}
+ .d2-4163031082 .fill-AB5{fill:#F7F8FE;}
+ .d2-4163031082 .stroke-N1{stroke:#0A0F25;}
+ .d2-4163031082 .stroke-N2{stroke:#676C7E;}
+ .d2-4163031082 .stroke-N3{stroke:#9499AB;}
+ .d2-4163031082 .stroke-N4{stroke:#CFD2DD;}
+ .d2-4163031082 .stroke-N5{stroke:#DEE1EB;}
+ .d2-4163031082 .stroke-N6{stroke:#EEF1F8;}
+ .d2-4163031082 .stroke-N7{stroke:#FFFFFF;}
+ .d2-4163031082 .stroke-B1{stroke:#0D32B2;}
+ .d2-4163031082 .stroke-B2{stroke:#0D32B2;}
+ .d2-4163031082 .stroke-B3{stroke:#E3E9FD;}
+ .d2-4163031082 .stroke-B4{stroke:#E3E9FD;}
+ .d2-4163031082 .stroke-B5{stroke:#EDF0FD;}
+ .d2-4163031082 .stroke-B6{stroke:#F7F8FE;}
+ .d2-4163031082 .stroke-AA2{stroke:#4A6FF3;}
+ .d2-4163031082 .stroke-AA4{stroke:#EDF0FD;}
+ .d2-4163031082 .stroke-AA5{stroke:#F7F8FE;}
+ .d2-4163031082 .stroke-AB4{stroke:#EDF0FD;}
+ .d2-4163031082 .stroke-AB5{stroke:#F7F8FE;}
+ .d2-4163031082 .background-color-N1{background-color:#0A0F25;}
+ .d2-4163031082 .background-color-N2{background-color:#676C7E;}
+ .d2-4163031082 .background-color-N3{background-color:#9499AB;}
+ .d2-4163031082 .background-color-N4{background-color:#CFD2DD;}
+ .d2-4163031082 .background-color-N5{background-color:#DEE1EB;}
+ .d2-4163031082 .background-color-N6{background-color:#EEF1F8;}
+ .d2-4163031082 .background-color-N7{background-color:#FFFFFF;}
+ .d2-4163031082 .background-color-B1{background-color:#0D32B2;}
+ .d2-4163031082 .background-color-B2{background-color:#0D32B2;}
+ .d2-4163031082 .background-color-B3{background-color:#E3E9FD;}
+ .d2-4163031082 .background-color-B4{background-color:#E3E9FD;}
+ .d2-4163031082 .background-color-B5{background-color:#EDF0FD;}
+ .d2-4163031082 .background-color-B6{background-color:#F7F8FE;}
+ .d2-4163031082 .background-color-AA2{background-color:#4A6FF3;}
+ .d2-4163031082 .background-color-AA4{background-color:#EDF0FD;}
+ .d2-4163031082 .background-color-AA5{background-color:#F7F8FE;}
+ .d2-4163031082 .background-color-AB4{background-color:#EDF0FD;}
+ .d2-4163031082 .background-color-AB5{background-color:#F7F8FE;}
+ .d2-4163031082 .color-N1{color:#0A0F25;}
+ .d2-4163031082 .color-N2{color:#676C7E;}
+ .d2-4163031082 .color-N3{color:#9499AB;}
+ .d2-4163031082 .color-N4{color:#CFD2DD;}
+ .d2-4163031082 .color-N5{color:#DEE1EB;}
+ .d2-4163031082 .color-N6{color:#EEF1F8;}
+ .d2-4163031082 .color-N7{color:#FFFFFF;}
+ .d2-4163031082 .color-B1{color:#0D32B2;}
+ .d2-4163031082 .color-B2{color:#0D32B2;}
+ .d2-4163031082 .color-B3{color:#E3E9FD;}
+ .d2-4163031082 .color-B4{color:#E3E9FD;}
+ .d2-4163031082 .color-B5{color:#EDF0FD;}
+ .d2-4163031082 .color-B6{color:#F7F8FE;}
+ .d2-4163031082 .color-AA2{color:#4A6FF3;}
+ .d2-4163031082 .color-AA4{color:#EDF0FD;}
+ .d2-4163031082 .color-AA5{color:#F7F8FE;}
+ .d2-4163031082 .color-AB4{color:#EDF0FD;}
+ .d2-4163031082 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>abc https://google.com/root.layers.d
+
+
+
+
+
+
+d
+
+
+
\ No newline at end of file
diff --git a/e2etests/txtar.txt b/e2etests/txtar.txt
index 6a7547486..5434bacb2 100644
--- a/e2etests/txtar.txt
+++ b/e2etests/txtar.txt
@@ -675,11 +675,17 @@ formula: {
-- link-on-connections --
-a: {
- link: https://twitter.com
+a <-> b: {
+ link: https://google.com/
}
-a <-> b: {
- link: https://google.com
+b -> c: {
+ link: layers.d
+}
+
+layers: {
+ d: {
+ d
+ }
}
>>>>>>> a468259f1 (html links are working on connections)