Skip to content

Update svgl extension#20852

Merged
raycastbot merged 2 commits intoraycast:mainfrom
ridemountainpig:svgl-prefix-svg
Aug 8, 2025
Merged

Update svgl extension#20852
raycastbot merged 2 commits intoraycast:mainfrom
ridemountainpig:svgl-prefix-svg

Conversation

@ridemountainpig
Copy link
Contributor

Description

Add the script to prefix the SVG IDs to avoid conflicts with other SVGs.

Screencast

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: svgl Issues related to the svgl extension AI Extension labels Aug 8, 2025
@raycastbot
Copy link
Collaborator

Thank you for your contribution! 🎉

🔔 @1weiho you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

Due to our current reduced availability during summer, the initial review may take up to 10-15 business days.

@raycastbot raycastbot added the OP is contributor The OP of the PR is a contributor of the extension label Aug 8, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR adds SVG ID prefixing functionality to the svgl extension to prevent conflicts when multiple SVGs are used together. The implementation introduces two new utility functions in prefix-svg.ts: getPrefixFromSvgUrl() which generates a unique prefix from SVG URLs by extracting the filename and converting hyphens to underscores, and prefixSvgIds() which uses regex to replace both id attributes and url() references in SVG content with prefixed versions.

The core integration happens in the existing fetchSvg() function in utils/fetch.ts, where all fetched SVGs are automatically processed to apply the prefixing. This addresses a common web development issue where SVG elements with identical internal IDs (like gradients, masks, or patterns) can cause rendering conflicts when multiple SVGs are displayed on the same page. The solution is particularly valuable for the svgl extension since users frequently copy multiple SVG logos that may share common ID patterns from similar authoring tools.

The CHANGELOG entry properly documents this enhancement using the required {PR_MERGE_DATE} format and is correctly positioned at the top. A minor JSON formatting improvement in package.json adds proper spacing for consistency.

Confidence score: 3/5

  • This PR introduces a potentially breaking change to cached SVG content without updating cache keys
  • Score reflects concern about existing cached SVGs that may break since cache keys remain unchanged but content format is modified
  • Pay close attention to utils/fetch.ts for the cache invalidation issue

4 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

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

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit 5820e71 into raycast:main Aug 8, 2025
2 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2025

Published to the Raycast Store:
https://raycast.com/1weiho/svgl

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

@ridemountainpig ridemountainpig deleted the svgl-prefix-svg branch August 8, 2025 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Extension extension fix / improvement Label for PRs with extension's fix improvements extension: svgl Issues related to the svgl extension OP is contributor The OP of the PR is a contributor of the extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants