Skip to content
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

Double arrow markers are too aggressively removed #1721

Closed
erikvullings opened this issue Dec 4, 2022 · 3 comments
Closed

Double arrow markers are too aggressively removed #1721

erikvullings opened this issue Dec 4, 2022 · 3 comments
Labels

Comments

@erikvullings
Copy link

Describe the bug
In Inkscape, I create a simple line with double arrows, i.e. a marker at the start and at the end. After optimizing the SVG, one of the arrows is removed. In particular, the marker-end refers to a url, but its definition has been removed.

To Reproduce
Steps to reproduce the behavior:

  1. Open the attached SVG
  2. svgo double_arrow_test.svg
  3. Open the optimized error again, and notice that one marker is removed.

Expected behavior
Both arrows should be kept.

Screenshots
Original
image

After optimizing
image

Desktop (please complete the following information):

  • SVGO Version 3.0.2
  • NodeJs Version 16.18.1
  • OS: Ubuntu 20.04 on WSL2

Original Inkscape file:
double_arrow_test

@Darkproduct
Copy link

I just had the same issue. It looks like the bug is in the cleanupIds Plugin. Disabling this feature fixes the missing markers.

Here is a working config:

module.exports = {
  multipass: true,
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          // viewBox is required to resize SVGs
          // @see https://github.com/svg/svgo/issues/1128
          removeViewBox: false,
          // Removes markers
          // @see https://github.com/svg/svgo/issues/1721
          cleanupIds: false,
        },
      },
    },
  ],
};

@hashimaziz1
Copy link

Enabling the prefixIds plugin would likely be a better solution for this that would allow cleanupIds to remain enabled.

@SethFalco
Copy link
Member

Hey! Thanks for reporting the issue and providing an example.
This has been incidentally resolved in a recent PR. (#1795)

The fix will be released in v3.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants