Skip to content

Commit ee0a0f5

Browse files
authored
docs(removeXlink): add tip to run plugin last (#1840)
1 parent bf5cf1f commit ee0a0f5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

docs/03-plugins/remove-xlink.mdx

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Removes XLink namespace prefixes and converts references to XLink attributes to
1616
* Drop all other references to the XLink namespace.
1717
* Remove XLink namespace declarations.
1818

19+
:::tip
20+
21+
When using this plugin, it's recommended to put it toward the end of your pipeline. Other SVGO plugins may add the XLink namespace, and these won't be migrated if they're added after this plugin has already executed.
22+
23+
:::
24+
1925
In most cases this will remove all references to XLink, but if legacy elements that are deprecated or removed in SVG 2 are found, the references are preserved as those elements do not support the SVG 2 `href` attribute. You can set `includeLegacy` to `true` to apply the plugin in this case too.
2026

2127
The following support `xlink:href` but not the SVG 2 `href` attribute:
@@ -26,7 +32,7 @@ The following support `xlink:href` but not the SVG 2 `href` attribute:
2632
* [`<glyphRef>`](https://developer.mozilla.org/docs/Web/SVG/Element/glyphRef)
2733
* [`<tref>`](https://developer.mozilla.org/docs/Web/SVG/Element/tref)
2834

29-
It's recommended to use this plugin if you intend to inline SVGs into an HTML document, the `includeLegacy` can be safely used in this case too. HTML does not support explicit namespaces, so namespace prefixes are ignored by the browser anyway.
35+
It's recommended to use this plugin if you intend to inline SVGs into an HTML document, `includeLegacy` can be safely set to `true` in this case too. HTML does not support explicit namespaces, so namespace prefixes are ignored by the browser anyway.
3036

3137
:::danger
3238

docs/03-plugins/reuse-paths.mdx

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ It looks for `<path>` elements that have the same [`d`](https://developer.mozill
1010

1111
If the path contains other attributes, such as `style` or `transform`, they will be preserved in the `<use>` element that supersedes it.
1212

13+
:::tip
14+
15+
If you only need SVG 2 or inline HTML compatibility, it's recommended to include the [Remove Xlink](/docs/plugins/remove-xlink/) plugin towards the end of your pipeline to convert references to `xlink:href` to the SVG 2 `href` attribute.
16+
17+
:::
18+
1319
## Usage
1420

1521
<PluginUsage/>

0 commit comments

Comments
 (0)