Skip to content

Draw the assistant's replies as formatted text, not Markdown source - #47

Merged
davior merged 1 commit into
mainfrom
claude/beautiful-wright-og4xur
Nov 5, 2026
Merged

davior merged 1 commit into
mainfrom
claude/beautiful-wright-og4xur

Conversation

@davior

@davior davior commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Summary

The assistant's replies went through a small hand-written renderer that knew bold, italics, code and simple dashed lists. Headings, numbered lists, tables, links and quotes still showed as Markdown source. Replies now go through a new Markdown component (react-markdown with remark-gfm, the same libraries and versions Notes uses), and the hand-written Prose/inline helpers are removed. It draws:

  • bold and italics

  • lists, bulleted and numbered

  • code (inline and fenced)

  • quotes

  • links

  • tables

  • Links: a path inside the app stays inside it. Anything else opens in a new tab with noopener.

  • Safety: raw HTML in a reply is never rendered and a javascript: link is dropped, so no separate sanitiser is needed.

  • Headings: they become bold lines rather than page headings, because the panel already has its own title.

  • Styling: every element is styled in the component rather than by Tailwind's typography plugin, so a reply matches the rest of the panel in light, dark and custom themes.

Only the assistant's reply changes. The user's own messages and the proposal cards are untouched. The same change is in GAM (davior/gam#65).

Test plan

  • npm run lint: clean
  • npm test: 240 passing, including the new tests:
    • Markdown.test.tsx covers bold, lists and code, headings, tables, links, and raw HTML and script links being refused.
    • AssistantPanel.test.tsx covers a Markdown reply being drawn instead of showing its marks.
  • npm run build: OK, which also typechecks

Deployment

Only the frontend changes (new dependencies react-markdown and remark-gfm, installed during the build). No backend change, no migration, no setting.

git pull origin main
docker compose up --build -d

Hard-refresh afterwards, then ask the assistant something that makes it answer with a list or bold text. It should be drawn as formatted text with no asterisks showing.


Generated by Claude Code

The assistant's replies went through a small hand-written renderer that knew bold,
italics, code and simple dashed lists, so headings, numbered lists, tables, links
and quotes still showed as Markdown source. Replies now go through a Markdown
component (react-markdown with remark-gfm, as Notes uses) that draws all of them.

Raw HTML in a reply is never rendered and a script link is dropped, so no separate
sanitiser is needed. Headings become bold lines rather than page headings, links
inside the app stay in it and others open in a new tab.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD2ELWgL2sDpxYbx3Aw
@davior
davior marked this pull request as ready for review November 5, 2026 23:58
@davior
davior merged commit 21d60ca into main Nov 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants