terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
16.72k stars 419 forks source link

Additional space on grid layout #2143

Closed chrisirhc closed 1 week ago

chrisirhc commented 1 week ago

Reproduction:

grid-columns: 1

a: "" {
  grid-gap: 0
  grid-columns: 2
  A
  B
}
b: "" {
  grid-gap: 0
  grid-columns: 2
  XYZ
  D
}

https://play.d2lang.com/?script=Si_KTNFNzs8pzc0rtlIw5OJKtFJQUlKo5lJQAEulJxZYKRjAeHCFRlwKCo5cCgpOXLVcSUTriIiM4lJQcOGq5QIEAAD__w%3D%3D&layout=dagre&

Expected two blocks containing two items each. But looks like the first one contains more items.

image
alixander commented 1 week ago

There's a section on the docs for this =)

https://d2lang.com/tour/grid-diagrams/#why-is-there-extra-padding-in-one-cell