#2784·d2

ascii mode: newlines in labels should not mess things up

Author: quinoxCreated Jul 25, 2026Updated Aug 26, 2026

Real nice to see ASCII output!

Slight issue with newlines in labels: they appear to get ignored by the layout engine, resulting in broken output:

Input:

txt
foobar -> buzbux: "foo\nbar"
buzbux: {
  label: "some\ntext"
}

Expected:

txt
┌──────────┐  
│  foobar  │  
│          │  
└──────────┘  
      │       
     foo
     bar    
      │       
      ▼       
┌──────────┐
│          │
│   some   │
│   text   │
│          │
└──────────┘

Actual:

txt
 ┌─────────┐  
 │ foobar  │  
 │         │  
 └─────────┘  
      │       
   foo
bar    
      │       
      ▼       
  ┌──────────┐
  │          │
  │some
text │
  │          │
  └──────────┘

https://play.d2lang.com/?script=SsvPT0osUtC1U0gqrUoqrbBSUErLz4_JS0osUuKCCVVzKSjkJCal5lgpKBXn56bG5JWkVpQocdVyAQIAAP__&ascii=1&