terrastruct / d2

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

about handling '&' in markdown #1898

Open bo-ku-ra opened 6 months ago

bo-ku-ra commented 6 months ago

API error https://play.d2lang.com/?l=&script=BMCxDgIhDADQna9obnC8xhsJ4LcQWsHEUgWSLnz8PWFRD1vIAYQMbfA7Hm2t3_SIZnZW1frls6jg5DxKe_0jXY_OZp9OavF5JLoC5uS2uwMAAP__&

url is difficult to handle. https://play.d2lang.com/?l=&script=BMAxDsMgDADAnVdYGTrGasY0pG-xYhcq1ZgCkhcen1NR22EqB4CDIDf5xCWPUfuO6O5rMks_WS9T7ELtyu9_5O1BWl9F3L-FzeNzOXk7kM4wwx0AAP__&

alixander commented 6 months ago

Notes:

<a href="asdf&asdf">b</a> doesn't work because it's raw html which is rendered as-is without escapes (in order for the html to work), but the ampersand gets interpreted as an XML entity in SVG (like &lsqou;).

https://github.com/yuin/goldmark is so extensible i'm sure there's a way to add a parsing extension that replaces & with &amp; or make urls safe when rendering unsafe html. Not high priority to do right now