Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with connection to grid cell container #1719

Closed
mrsaiz opened this issue Nov 10, 2023 · 0 comments · Fixed by #1729
Closed

Error with connection to grid cell container #1719

mrsaiz opened this issue Nov 10, 2023 · 0 comments · Fixed by #1729
Assignees

Comments

@mrsaiz
Copy link

mrsaiz commented Nov 10, 2023

Hello,

I am using the D2 version 0.6.1 and I am getting an error when compiling the next diagram locally:

grid-rows: 1
grid-columns: 2

box1: {
}

box2: {
  explanation: |md
    hello world!
  |
}
box1 -> box2
> d2 -l tala issue.d2 issue.svg
panic: runtime error: index out of range [1] with length 0

goroutine 67 [running]:
oss.terrastruct.com/d2/d2renderers/d2svg.getArrowheadAdjustments({{0x14000436240, 0x11}, {0x0, 0x0, 0x0}, {0x1400053a470, 0x4}, {0x104ed7bc2, 0x4}, 0x0, ...}, ...)
	oss.terrastruct.com/d2/d2renderers/d2svg/d2svg.go:366 +0x120
oss.terrastruct.com/d2/d2renderers/d2svg.drawConnection({_, _}, {_, _}, {{0x14000436240, 0x11}, {0x0, 0x0, 0x0}, {0x1400053a470, ...}, ...}, ...)
	oss.terrastruct.com/d2/d2renderers/d2svg/d2svg.go:524 +0x5f0
oss.terrastruct.com/d2/d2renderers/d2svg.Render(0x14000768000, 0x14000814028)
	oss.terrastruct.com/d2/d2renderers/d2svg/d2svg.go:1788 +0x868
oss.terrastruct.com/d2/d2cli._render({0x105dca580, 0x14000554000}, 0x14000617140?, {0x105dcb868, 0x14000470180}, {0x1400053a630, 0x1400053a628, 0x1400053a638, 0x1065bd6e0, 0x0, ...}, ...)
	oss.terrastruct.com/d2/d2cli/main.go:733 +0x25c
oss.terrastruct.com/d2/d2cli.render({0x105dca580, 0x14000554000}, 0x140003f2f50, 0xccd2dd8, {0x105dcb868, 0x14000470180}, {0x1400053a630, 0x1400053a628, 0x1400053a638, 0x1065bd6e0, ...}, ...)
	oss.terrastruct.com/d2/d2cli/main.go:711 +0x744
oss.terrastruct.com/d2/d2cli.compile({0x105dca580?, 0x14000554000}, 0x140003f2f50, {0x140003ca6c0, 0x3, 0x4}, 0x140005a4060, {0x1400053a630, 0x1400053a628, 0x1400053a638, ...}, ...)
	oss.terrastruct.com/d2/d2cli/main.go:508 +0x1204
oss.terrastruct.com/d2/d2cli.Run({0x105dca510?, 0x140005103c0?}, 0x140003f2f50)
	oss.terrastruct.com/d2/d2cli/main.go:334 +0x1e74
oss.terrastruct.com/util-go/xmain.(*State).Main.func1()
	oss.terrastruct.com/util-go@v0.0.0-20230604222829-11c3c60fec14/xmain/xmain.go:105 +0x64
created by oss.terrastruct.com/util-go/xmain.(*State).Main in goroutine 1
	oss.terrastruct.com/util-go@v0.0.0-20230604222829-11c3c60fec14/xmain/xmain.go:103 +0x104

If I remove the connection or the markdown, it works.

grid-rows: 1
grid-columns: 2

box1: {
}

box2: {
  explanation: |md
    hello world!
  |
} 
# this works!
grid-rows: 1
grid-columns: 2

box1: {
}

box2: {
}
box1 -> box2
# this works!

However, when using the D2 Studio Playground, this issue is not happening and everything is working as expected...

image

https://play.d2lang.com/?script=gvvOSsGQC9n7VgpGXFxJ-RWGYNLISqGaS0EhtaIgJzEvERTIVgo1uSlcCgoKChmpOTn5CuX5RTkpilwKCjVctWB9Crp2CiCdXIAAAAD__w%3D%3D&layout=tala&

@cyborg-ts cyborg-ts added this to D2 Nov 10, 2023
@gavin-ts gavin-ts changed the title Error when using markdown in combination with connections Error with connection to grid cell container Nov 14, 2023
@github-project-automation github-project-automation bot moved this to Done in D2 Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants