Skip to content

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

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 writes its reply in Markdown, but the panel showed it as plain text with the asterisks, dashes and hashes still in it. Replies now go through a new Markdown component (react-markdown with remark-gfm, the same libraries and versions Notes uses). It draws:

  • bold and italics

  • lists

  • 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 prompt and the proposal cards are untouched. The same change is going into GVC.

Test plan

  • npm run lint: clean
  • npm test: 493 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 writes its reply in Markdown, and the panel showed it as plain text
with the asterisks, dashes and hashes still in it. Replies now go through a
Markdown component (react-markdown with remark-gfm, as Notes uses): bold and
italics, lists, code, quotes, links and tables are drawn as such.

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 dcb9db6 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