Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Simple svg not rendering an element

I am using the rust svg crate to render an svg and I am only getting one of 2 objects. The generated svg is this:

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<path d="M20,20 l0,50 l50,0 l0,-50 z" fill="none" stroke="black" stroke-width="3">
<path d="M10,30 l0,50 l50,0 l0,-50 z" fill="none" stroke="black" stroke-width="3"/>
</path>
</svg>

I see this:
enter image description here

The other path which is clearly computed at an offset is nowhere to be seen. What do I do?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You cannot put a path inside another path since it’s not permitted content. So your svg is invalid.
This would be valid instead:

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
  <path d="M20,20 l0,50 l50,0 l0,-50 z" fill="none" stroke="black" stroke-width="3"/>
  <path d="M10,30 l0,50 l50,0 l0,-50 z" fill="none" stroke="black" stroke-width="3"/>
</svg>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading