Closed
Description
Feature Description
Gitea's SVG files do not have the xmlns
attribute. Without it, these SVG images couldn't be display correctly.
- Browsers (Safari/Chrome/Firefox) only display the XML content, but no the image
- VSCode shows 0 x 0 broken images
- macOS Finder show blank page
Then developers couldn't browse these images, they couldn't know what the images look like before rendering them as inline SVG in a page.
So it's better to keep/add the xmlns
attribute for the generated SVG files.
https://stackoverflow.com/questions/18467982/are-svg-parameters-such-as-xmlns-and-version-needed
cc @silverwind
Activity
silverwind commentedon Mar 10, 2023
Yes it would be welcome to add
xmlns
to SVGs before rendering. GitHub also recently did this change.silverwind commentedon Mar 10, 2023
Actually I misread. You are talking about SVG assets, I'm talking about user content SVG image rendering.
xmlns
is optional for SVG embedded inside HTML. It's only necessary when a SVG is rendered as it's own document, which we don't do. Adding it into HTML rendering would blow up our HTML unnecessarily by a few kilobytes, GitHub also does not do this.wxiaoguang commentedon Mar 10, 2023
Yup, for rendering, they do not need the xmlns.
We can remove the attribute before rendering, how do you think?
wxiaoguang commentedon Mar 10, 2023
The PR: Keep/add xmlns attribute for generated SVG images #23410
The output is still clear, and developers could understand/choose SVG images quickly.
Keep (add if not existing) xmlns attribute for generated SVG images (#…