You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: line jumps (hops) where connections cross #3005
When two connections cross, D2 draws them straight through each other. In a busy diagrams it can sometimes be you hard to tell whether two lines cross or meet, adding a follow a connection to its end.
Many diagramming tools (draw.io, Visio, Lucidchart, PlantUML via skinparam) solve this with line jumps: at each crossing, one of the lines draws a small arc (a "hop") or a gap over the other.
It would be really cool if D2 could support this as an option.
Minimal example
a -> xa -> yb -> xb -> y
With two sources each connected to both targets, any layered layout has to cross two of the connections.
Rendered with d2 --layout=elk crossing.d2 (D2 v0.9.0):
The a -> y and b -> x connections cross in the middle, with nothing to show that they don't join there. Dagre (the default) has the same crossing:
Proposed behaviour
At each point where two connections cross, draw a small semicircular hop (or a gap) in one of them. Here is the Dagre example above, mocked up in diagrams.net to show the expected result:
This would be off by default and enabled through config, for example:
or a CLI flag (--line-jumps=arc), or a per-connection style.line-jump.
Possible details:
Which line hops: a consistent rule, such as horizontal lines hop over vertical lines, or the connection declared later hops over the earlier one. This is how draw.io and Visio handle it.
Size: a fixed radius relative to the stroke width, possibly configurable.
Scope: crossings between connections only. Connections passing behind shapes don't need it.
Motivation
Large architecture and network diagrams often can't avoid crossings, even with ELK or TALA.
Line jumps are a familiar convention in engineering, electrical and network diagrams.
Because they're applied after layout (a rendering step on the final connection paths), they should work the same with every layout engine.
Disclosure: I used Claude to help draft this issue, but reviewed the content and the example diagrams myself before submitting.
@alixander ah excellent good to know! Looking forward to using it :)
I suppose there's an extension that could be made here for adding the arc-type jump as well as the gap-type one, but if I find myself burning with desire for that I can open a fresh issue 👍
Activity
alixander commentedon Nov 23, 2026
Thanks for the four-edge example. We implemented the gap variant in #3011. It works by default with ELK and Dagre and will be in the next D2 release.
At the red X in this SVG, the connection from g to a stays continuous. The connection from b to d has a small gap where they cross.
pjpscriv commentedon Nov 24, 2026
@alixander ah excellent good to know! Looking forward to using it :)
I suppose there's an extension that could be made here for adding the arc-type jump as well as the gap-type one, but if I find myself burning with desire for that I can open a fresh issue 👍