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

Fix invalid SVG error when using special char in layer lable #55

Merged

Conversation

HelloThisIsFlo
Copy link
Contributor

Hi @caksoylar,

This is a super quick PR to fix an issue with string escape. I have a layer called <^v> (my nav layer), and it causes issues with the draw function.

The draw function would not see any error, but the resulting SVG is invalid. This is the error

error on line 2462 at column 50: Unescaped '<' not allowed in attributes values

The fix was super quick, I just used your pre-existing escape function to escape the name. I tested it and it works as expected.

One thing to note: I couldn't see where the layer styling class is actually used 🤔. So it is now correctly escaped, but it appears the classname isn't used anywhere. So, either it is indeed not used, and that's fine. Or it is used somewhere and I missed it. In which case, let me know where and I'll update the PR.

Thank you for your work 🙏

@caksoylar
Copy link
Owner

Thank you, good fix! The class isn't used by keymap-drawer by default but it allows people to use it in their CSS (e.g. in svg_extra_style), if they want to do any per-layer styling.

@caksoylar caksoylar merged commit ef14582 into caksoylar:main Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants