d2 icon indicating copy to clipboard operation
d2 copied to clipboard

Bad SVG generation with markdown newlines

Open mrtryhard opened this issue 3 years ago • 1 comments

Summary

OS: Ubuntu 22.04 Browser: Firefox 107.0 D2 cli version: v0.0.13 Error: When compiling a node with markdown inside, it will create an invalid SVG file. See below. XML Parsing Error: mismatched tag. Expected: </br>. image

Expected result

  1. Either a compiler error if new lines are not supported
  2. Or the following image: image

Note

It requires 2 things to produce a working SVG:

  1. Replace <br> with <br />
  2. The height on the foreignObject should be adjusted (from 24 to 48 in my case)

Code to reproduce

d2 file.d2 file.svg

mainframe: Mainframe Banking System {
  explanation: |md 
  Stores all of the core banking information  
  about customers, accounts, transactions, etc.
  |
  style: {
    stroke: "#aaaaaa"
  }
} 

mrtryhard avatar Nov 25 '22 15:11 mrtryhard

thank you for the 💯 bug report

alixander avatar Nov 25 '22 16:11 alixander