diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index c8eb0dc2a..3f80a0c09 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -40,4 +40,5 @@ - Fixes scaling of actor shapes in sequence diagrams. [#702](https://github.com/terrastruct/d2/pull/702) - Sequence diagram note ordering was sometimes wrong. [#796](https://github.com/terrastruct/d2/pull/796) - Images can now be set to sizes smaller than 128x128. [#702](https://github.com/terrastruct/d2/pull/702) +- Tooltips with ampersand would result in invalid SVGs. [#798](https://github.com/terrastruct/d2/pull/798) - Fixes class height when there are no rows. [#756](https://github.com/terrastruct/d2/pull/756) diff --git a/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg b/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg index d2aee73c9..cf50b884e 100644 --- a/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg +++ b/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg @@ -39,7 +39,7 @@ width="1433" height="1589" viewBox="-146 -71 1433 1589">&∈ + + + + + + + + + + + + +beans & ricefoo&bar + + + \ No newline at end of file diff --git a/e2etests/testdata/regression/ampersand-escape/elk/board.exp.json b/e2etests/testdata/regression/ampersand-escape/elk/board.exp.json new file mode 100644 index 000000000..72514d740 --- /dev/null +++ b/e2etests/testdata/regression/ampersand-escape/elk/board.exp.json @@ -0,0 +1,130 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "h&y", + "type": "rectangle", + "pos": { + "x": 12, + "y": 12 + }, + "width": 98, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "beans & rice", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "&∈", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 21, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "foo", + "type": "rectangle", + "pos": { + "x": 130, + "y": 12 + }, + "width": 69, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "foo", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 24, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "\"&bar\"", + "type": "rectangle", + "pos": { + "x": 219, + "y": 12 + }, + "width": 81, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "&bar", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 36, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [] +} diff --git a/e2etests/testdata/regression/ampersand-escape/elk/sketch.exp.svg b/e2etests/testdata/regression/ampersand-escape/elk/sketch.exp.svg new file mode 100644 index 000000000..4af4dc8e3 --- /dev/null +++ b/e2etests/testdata/regression/ampersand-escape/elk/sketch.exp.svg @@ -0,0 +1,68 @@ + +&∈ + + + + + + + + + + + + +beans & ricefoo&bar + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/links/dagre/sketch.exp.svg b/e2etests/testdata/stable/links/dagre/sketch.exp.svg index 4d5b97671..921cd83b6 100644 --- a/e2etests/testdata/stable/links/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/links/dagre/sketch.exp.svg @@ -64,8 +64,7 @@ width="338" height="452" viewBox="-102 -118 338 452">