From bd443c4862727c985acef207f405d200ccb4a498 Mon Sep 17 00:00:00 2001
From: bergeouss <48155732+bergeouss@users.noreply.github.com>
Date: Thu, 23 Apr 2026 18:45:20 +0200
Subject: [PATCH] fix(markdown): stash code blocks with attributes and
multiline content (#890) (#891)
The _ob_stash regex in renderMd() used ([^<]*) which failed
to match tags (attributes) and couldn't capture
multiline content. Code blocks leaked into the bold/italic pipeline,
corrupting SQL/C# comments into tags and producing <
artifacts.
Replace with (]*>[\s\S]*?) to handle attributes and
multiline content correctly.
Closes #890
Co-authored-by: Claude Opus 4.7
---
static/ui.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/static/ui.js b/static/ui.js
index f0023b0..214c9e7 100644
--- a/static/ui.js
+++ b/static/ui.js
@@ -630,7 +630,7 @@ function renderMd(raw){
// Stash tags from the backtick pass above so the outer bold/italic
// regexes don't esc() their content (e.g. **`code`** → code)
const _ob_stash=[];
- s=s.replace(/([^<]*<\/code>)/g,m=>{_ob_stash.push(m);return `\x00O${_ob_stash.length-1}\x00`;});
+ s=s.replace(/(]*>[\s\S]*?<\/code>)/g,m=>{_ob_stash.push(m);return `\x00O${_ob_stash.length-1}\x00`;});
s=s.replace(/\*\*\*(.+?)\*\*\*/g,(_,t)=>`${esc(t)}`);
s=s.replace(/\*\*(.+?)\*\*/g,(_,t)=>`${esc(t)}`);
s=s.replace(/\*([^*\n]+)\*/g,(_,t)=>`${esc(t)}`);