From 2da0cf94215330ef719e0db70784e5249b032fee Mon Sep 17 00:00:00 2001 From: Augustin Date: Thu, 23 Apr 2026 22:10:54 +0200 Subject: [PATCH] fix(studio): convert newlines to
in AI message rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formatText now replaces \n with
so AI responses display with proper line breaks instead of a single unbroken block. 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush --- web/src/components/Studio.jsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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, '')