.. include:: /Includes.rst.txt .. _adr-012: ======================================================== ADR-012: Markdown Rendering with marked.js and DOMPurify ======================================================== **Status:** Accepted **Date:** 2026-03-17 Context ======= LLM responses frequently contain Markdown: headings, bullet lists, numbered steps, code blocks, and tables. Displaying these as raw text degrades readability significantly. The rendered output must be XSS-safe: a compromised or adversarially prompted LLM could produce HTML or JavaScript in its response. Alternatives considered: - **Plain text only**: Safe, but unreadable for structured responses. - **Server-side Markdown-to-HTML (PHP)**: Requires a PHP Markdown library, adds a server round-trip for each render, and moves rendering responsibility to the server. - **``innerHTML`` without sanitization**: Fast, but allows XSS if the LLM output contains ``