You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classes: {
clair: {
label: Clairicon: https://worldvectorlogo.com/download/clair.svgshape: image
}
sonarqube: {
label: SonarQubeicon: https://worldvectorlogo.com/download/sonarqube.svg#icon: https://icons-for-free.com/iff/png/256/sonarqube-1336519700268537013.png # same thing happens with this pngshape: image
}
}
clair.class: clairsonarqube.class: sonarqube
but if I wget and open the icons they look correct.
Proposed Solution
D2 should verify the icons format and error out if failing to pull icons correctly, or if they're invalid due to websites sending back some 403 style textual error, rather than generating diagrams with broken icon placeholders in them and returning exit code 0.
The full source code template showing this usage can be seen here:
These failures to import these icons result in no error but missing icons in the diagram and still the d2 command returns a successful exit code 0.
This is bad because my HariSekhon/Diagrams-as-Code repo uses GitHub Actions to automatically (re)generate d2 diagrams upon any change to their source code and if it can't detect these sorts of breakages then it will update the diagram with broken icons and save that, which it has, and had to be noticed by me manually due to d2 not doing correct exit code signalling.
The text was updated successfully, but these errors were encountered:
HariSekhon
changed the title
Some SVG source icons fail to appear in diagram but d2 command returns successful exit code 0
Some SVG & PNG source icons fail to appear in diagram but d2 command returns successful exit code 0
Feb 20, 2025
This was another bug (d2 cli should complain on invalid remote images, it was giving 200 but the cli wasn't interpreting the response correctly), thank you for filing it, will be fixed in next release: #2370
Summary
Some icon imports are not working - d2 generates broken diagrams with missing icons but exits with success code 0.
Example Code to Reproduce
I use classes for icon reuse - these work:
but these don't:
but if I
wget
and open the icons they look correct.Proposed Solution
D2 should verify the icons format and error out if failing to pull icons correctly, or if they're invalid due to websites sending back some 403 style textual error, rather than generating diagrams with broken icon placeholders in them and returning exit code 0.
The full source code template showing this usage can be seen here:
https://github.com/HariSekhon/Templates/blob/master/diagram.d2
or throughout my real world HariSekhon/Diagrams-as-Code repo.
These failures to import these icons result in no error but missing icons in the diagram and still the
d2
command returns a successful exit code 0.This is bad because my HariSekhon/Diagrams-as-Code repo uses GitHub Actions to automatically (re)generate d2 diagrams upon any change to their source code and if it can't detect these sorts of breakages then it will update the diagram with broken icons and save that, which it has, and had to be noticed by me manually due to d2 not doing correct exit code signalling.
The text was updated successfully, but these errors were encountered: