diff --git a/web/src/components/Studio.jsx b/web/src/components/Studio.jsx index cfdcd4b..dfc3028 100644 --- a/web/src/components/Studio.jsx +++ b/web/src/components/Studio.jsx @@ -53,11 +53,9 @@ function renderContent(text) { } function formatText(text) { - // First escape HTML entities let html = text .replace(/&/g, '&').replace(//g, '>') - // Apply markdown transformations (now with escaped brackets) html = html .replace(/\*\*(.+?)\*\*/g, '$1') .replace(/`([^`]+)`/g, '$1') @@ -66,10 +64,10 @@ function formatText(text) { .replace(/^# (.+)$/gm, '

$1

') .replace(/^\s*[-*] (.+)$/gm, '
• $1
') .replace(/^\s*(\d+)[.)] (.+)$/gm, '
$1 $2
') + .replace(/\n/g, '
') - // Sanitize: remove event handlers and dangerous protocols html = html - .replace(/\s+on\w+=["'][^"']*["']/gi, '') // Remove on* event handlers + .replace(/\s+on\w+=["'][^"']*["']/gi, '') .replace(/javascript:/gi, '') .replace(/data:/gi, '')