Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion frontend/src/components/floating-menus/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@
return text;
}

function escapeHtml(text: string): string {
return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
}

function parseMarkdown(markdown: string | undefined): string | undefined {
if (!markdown) return undefined;

// First, escape HTML special characters to prevent interpretation as HTML tags
const escaped = escapeHtml(markdown);

return (
markdown
escaped
// .split("\n")
// .map((line) => line.trim())
// .join("\n")
Expand Down