feat(ui): render markdown in message bubbles#1
Merged
Killea merged 2 commits intoKillea:mainfrom Feb 28, 2026
Merged
Conversation
Agent messages are written in markdown (headers, bold, tables, code blocks, lists, blockquotes). The console was displaying raw syntax instead of formatted output, making long exchanges hard to read. Add a lightweight inline markdown parser (no external dependencies): - Block elements: fenced code, tables, headings, HR, ul, ol, blockquote - Inline elements: backtick code, bold, italic, strikethrough - Input is HTML-escaped before transformation to prevent XSS - CSS added for all rendered elements, respecting existing CSS variables and the dark/light theme toggle The parser is intentionally minimal. It handles the subset of markdown that LLM agents realistically produce. A full CommonMark parser can replace it later without changing the call site (renderMarkdown).
f716c18 to
23879e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Agent messages are commonly written in markdown — headers, bold/italic text, tables, code blocks, numbered and bulleted lists. The current console renders raw markdown syntax, which makes longer exchanges difficult to read.
Example of what users see today vs. what they should see:
Solution
Add a lightweight inline markdown parser written in vanilla JavaScript (zero external dependencies, no CDN required):
```), tables, ATX headings (#–######), horizontal rules, unordered lists, ordered lists, blockquotes**bold**,*italic*,~~strikethrough~~.bubble-v2use the existing CSS variables (--accent,--border,--text-1, etc.) and respect the dark/light theme toggleThe call site replaces the previous one-liner:
The parser is intentionally minimal — it covers what LLM agents realistically produce. A full CommonMark implementation can replace it later without touching the call site.
Testing
Paste a message with mixed markdown into any thread via the compose box or the MCP
msg_posttool:Expected: all elements render correctly in both dark and light themes.