vscode-svgviewer
vscode-svgviewer copied to clipboard
Elements not visible with 'defs' / 'use'
Elements which are defined in a defs
section and then subsequently referenced by a use
element are not shown. See example file. I would expect the box to be visible (as it is when loaded with Edge or with Atom's SVG preview).
Using VSCode 1.7.2, SVG viewer 1.2.0.
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
width="128" height="128"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<g id="box">
<rect height="20" width="20"
stroke="black" fill="white"/>
</g>
</defs>
<use xlink:href="#box" x="50" y="50"/>
</svg>
Thanx @pedro-w Fixed this issue with v1.3.0
I'm still seeing this with v1.3.0, on VSCode 1.7.2 and macOS 10.11.6, using the exact SVG given by the OP. The same problem exists with <symbol>
+ <use>
.
Works for me with 1.4.2 on VSCode 1.13.1 on macOS.
Example from OP: displays alright. Another example that works:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 100 100">
<rect id="foo" x="0" y="0" width="50" height="50" fill="red"></rect>
<use xlink:href="#foo" x="50" y="50"></use>
</svg>