Skip to content

Fix invalid SVG syntax #39669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,13 @@ body {
}
```

```html
```html-nolint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this a single html block? Works okay for me locally, what do you think?

<svg viewBox="-1 -1 202 40" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <path
      id="smiley"
      d="M50,10 A40,40,1,1,1,50,90 A40,40,1,1,1,50,10 M30,40 Q36,35,42,40 M58,40 Q64,35,70,40 M30,60 Q50,75,70,60 Q50,75,30,60" />
  </defs>

  <rect x="0" y="0" width="60" height="30">
    <title>xMidYMid meet</title>
  </rect>
  <svg
    viewBox="0 0 100 100"
    width="60"
    height="30"
    preserveAspectRatio="xMidYMid meet"
    x="0"
    y="0">
    <use href="#smiley" />
  </svg>

  <rect x="70" y="0" width="60" height="30">
    <title>xMinYMid meet</title>
  </rect>
  <svg
    viewBox="0 0 100 100"
    width="60"
    height="30"
    preserveAspectRatio="xMinYMid meet"
    x="70"
    y="0">
    <use href="#smiley" />
  </svg>

  <rect x="140" y="0" width="60" height="30">
    <title>xMaxYMid meet</title>
  </rect>
  <svg
    viewBox="0 0 100 100"
    width="60"
    height="30"
    preserveAspectRatio="xMaxYMid meet"
    x="140"
    y="0">
    <use href="#smiley" />
  </svg>
</svg>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other examples are split so I think we should keep this split for consistency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, ok, let's leave it for now.

<svg viewBox="-1 -1 202 80" xmlns="http://www.w3.org/2000/svg">
<defs>
<path
id="smiley"
d="M50,10 A40,40,1,1,1,50,90 A40,40,1,1,1,50,10 M30,40 Q36,35,42,40 M58,40 Q64,35,70,40 M30,60 Q50,75,70,60 Q50,75,30,60" />
</defs>
</svg>
```

```html
Expand Down Expand Up @@ -441,18 +440,21 @@ body {
```

```html
<rect x="70" y="0" width="30" height="75">
<title>xMaxYMid slice</title>
</rect>
<svg
viewBox="0 0 100 100"
width="30"
height="75"
preserveAspectRatio="xMaxYMid slice"
x="70"
y="0">
<use href="#smiley" />
</svg>
<rect x="70" y="0" width="30" height="75">
<title>xMaxYMid slice</title>
</rect>
<svg
viewBox="0 0 100 100"
width="30"
height="75"
preserveAspectRatio="xMaxYMid slice"
x="70"
y="0">
<use href="#smiley" />
</svg>
```

```html-nolint
</svg>
```

Expand Down Expand Up @@ -491,30 +493,32 @@ body {
}
```

```html
```html-nolint
<svg viewBox="-1 -1 192 62" xmlns="http://www.w3.org/2000/svg">
<defs>
<path
id="smiley"
d="M50,10 A40,40,1,1,1,50,90 A40,40,1,1,1,50,10 M30,40 Q36,35,42,40 M58,40 Q64,35,70,40 M30,60 Q50,75,70,60 Q50,75,30,60" />
</defs>
</svg>
```

```html
<!-- none -->
<rect x="0" y="0" width="160" height="60">
<title>none</title>
</rect>
<svg
viewBox="0 0 100 100"
width="160"
height="60"
preserveAspectRatio="none"
x="0"
y="0">
<use href="#smiley" />
</svg>
<!-- none -->
<rect x="0" y="0" width="160" height="60">
<title>none</title>
</rect>
<svg
viewBox="0 0 100 100"
width="160"
height="60"
preserveAspectRatio="none"
x="0"
y="0">
<use href="#smiley" />
</svg>
```

```html-nolint
</svg>
```

Expand Down