From ee0a0f5130b0c1f1839613269543e7af3eacbeb1 Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Sat, 18 Nov 2023 18:19:25 +0000 Subject: [PATCH] docs(removeXlink): add tip to run plugin last (#1840) --- docs/03-plugins/remove-xlink.mdx | 8 +++++++- docs/03-plugins/reuse-paths.mdx | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/03-plugins/remove-xlink.mdx b/docs/03-plugins/remove-xlink.mdx index e43257894..887f862ff 100644 --- a/docs/03-plugins/remove-xlink.mdx +++ b/docs/03-plugins/remove-xlink.mdx @@ -16,6 +16,12 @@ Removes XLink namespace prefixes and converts references to XLink attributes to * Drop all other references to the XLink namespace. * Remove XLink namespace declarations. +:::tip + +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. + +::: + 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. 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: * [``](https://developer.mozilla.org/docs/Web/SVG/Element/glyphRef) * [``](https://developer.mozilla.org/docs/Web/SVG/Element/tref) -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. +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. :::danger diff --git a/docs/03-plugins/reuse-paths.mdx b/docs/03-plugins/reuse-paths.mdx index 17bfcd63b..f787b8ad0 100644 --- a/docs/03-plugins/reuse-paths.mdx +++ b/docs/03-plugins/reuse-paths.mdx @@ -10,6 +10,12 @@ It looks for `` elements that have the same [`d`](https://developer.mozill If the path contains other attributes, such as `style` or `transform`, they will be preserved in the `` element that supersedes it. +:::tip + +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. + +::: + ## Usage