-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Escape HTML in tooltips to prevent angle brackets being interpreted as tags #3524
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
Conversation
…kets Co-authored-by: Keavon <4388688+Keavon@users.noreply.github.com>
Keavon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should only have changed the one file.
Co-authored-by: Keavon <4388688+Keavon@users.noreply.github.com>
Fixed in commit 8f9c354. The PR now only includes changes to Tooltip.svelte. |
| } | ||
| function escapeHtml(text: string): string { | ||
| return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use apos instead of 39.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to ' in commit aa1431b.
Keavon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment
Co-authored-by: Keavon <4388688+Keavon@users.noreply.github.com>
Description
Tooltips containing Rust generic types like
Table<Vector<Option<Table<Graphic>>>>were being interpreted as HTML tags due to the{@html}directive inTooltip.svelte. The angle brackets caused the browser to attempt parsing them as elements, resulting in broken tooltip display.Changes
frontend/src/components/floating-menus/Tooltip.svelte:escapeHtml()function to escape<,>,&,",'charactersparseMarkdown()to escape HTML before applying markdown transformations (bold/italic/code)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.