Skip to content

[Proposal] Keep/add xmlns attribute for generated SVG images #23409

Closed
@wxiaoguang

Description

@wxiaoguang
Contributor

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

Screenshots

image

image

Activity

added
type/featureCompletely new functionality. Can only be merged if feature freeze is not active.
type/proposalThe new feature has not been accepted yet but needs to be discussed first.
on Mar 10, 2023
silverwind

silverwind commented on Mar 10, 2023

@silverwind
Member

Yes it would be welcome to add xmlns to SVGs before rendering. GitHub also recently did this change.

silverwind

silverwind commented on Mar 10, 2023

@silverwind
Member

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

wxiaoguang commented on Mar 10, 2023

@wxiaoguang
ContributorAuthor

Yup, for rendering, they do not need the xmlns.

We can remove the attribute before rendering, how do you think?

wxiaoguang

wxiaoguang commented on Mar 10, 2023

@wxiaoguang
ContributorAuthor

The PR: Keep/add xmlns attribute for generated SVG images #23410

The output is still clear, and developers could understand/choose SVG images quickly.

added
type/enhancementAn improvement of existing functionality
and removed
type/featureCompletely new functionality. Can only be merged if feature freeze is not active.
on Mar 17, 2023
added this to the 1.20.0 milestone on Mar 17, 2023
added a commit that references this issue on Mar 21, 2023
a797b84
locked and limited conversation to collaborators on May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementAn improvement of existing functionalitytype/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @lunny@silverwind@wxiaoguang

      Issue actions

        [Proposal] Keep/add `xmlns` attribute for generated SVG images · Issue #23409 · go-gitea/gitea