From 0be7ccde4c2c11f3603c5fabb20bf8499c205ef0 Mon Sep 17 00:00:00 2001 From: Hermes Date: Fri, 3 Apr 2026 00:27:43 +0000 Subject: [PATCH] feat: safe HTML rendering in AI responses + active session gold style + Sprint 16 tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit renderMd() now correctly renders safe inline HTML tags that AI models emit in their responses: Pre-pass (ui.js): Converts , , , , ,
to their markdown equivalents (**text**, *text*, `text`, newline) before the pipeline runs. Code blocks and backtick spans are stashed first so their content is never modified. inlineMd() helper (ui.js): New helper for processing inline formatting inside list items, blockquotes, and headings. Previously these used esc() directly, which escaped / tags that had already been converted from HTML by the pre-pass — causing them to appear as literal <strong> text instead of rendering as bold. inlineMd() applies bold/italic/code processing and then escapes only unknown tags. Safety net (ui.js): After the full pipeline, any HTML tags NOT emitted by our own renderer (i.e. , ") + assert " must be HTML-escaped.""" + out = render_md("") + assert "") + assert "