The _ob_stash regex in renderMd() used (<code>[^<]*</code>) which failed to match <code class="language-sql"> tags (attributes) and couldn't capture multiline content. Code blocks leaked into the bold/italic pipeline, corrupting SQL/C# comments into <strong><em> tags and producing < artifacts. Replace with (<code\b[^>]*>[\s\S]*?</code>) to handle attributes and multiline content correctly. Closes #890 Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -630,7 +630,7 @@ function renderMd(raw){
|
|||||||
// Stash <code> tags from the backtick pass above so the outer bold/italic
|
// Stash <code> tags from the backtick pass above so the outer bold/italic
|
||||||
// regexes don't esc() their content (e.g. **`code`** → <strong><code>code</code></strong>)
|
// regexes don't esc() their content (e.g. **`code`** → <strong><code>code</code></strong>)
|
||||||
const _ob_stash=[];
|
const _ob_stash=[];
|
||||||
s=s.replace(/(<code>[^<]*<\/code>)/g,m=>{_ob_stash.push(m);return `\x00O${_ob_stash.length-1}\x00`;});
|
s=s.replace(/(<code\b[^>]*>[\s\S]*?<\/code>)/g,m=>{_ob_stash.push(m);return `\x00O${_ob_stash.length-1}\x00`;});
|
||||||
s=s.replace(/\*\*\*(.+?)\*\*\*/g,(_,t)=>`<strong><em>${esc(t)}</em></strong>`);
|
s=s.replace(/\*\*\*(.+?)\*\*\*/g,(_,t)=>`<strong><em>${esc(t)}</em></strong>`);
|
||||||
s=s.replace(/\*\*(.+?)\*\*/g,(_,t)=>`<strong>${esc(t)}</strong>`);
|
s=s.replace(/\*\*(.+?)\*\*/g,(_,t)=>`<strong>${esc(t)}</strong>`);
|
||||||
s=s.replace(/\*([^*\n]+)\*/g,(_,t)=>`<em>${esc(t)}</em>`);
|
s=s.replace(/\*([^*\n]+)\*/g,(_,t)=>`<em>${esc(t)}</em>`);
|
||||||
|
|||||||
Reference in New Issue
Block a user