Skip to content

fix: replace marked+DOMPurify with react-markdown, add stable message keys#9

Merged
quiet-node merged 1 commit intomainfrom
worktree-fix-build-warnings
Mar 31, 2026
Merged

fix: replace marked+DOMPurify with react-markdown, add stable message keys#9
quiet-node merged 1 commit intomainfrom
worktree-fix-build-warnings

Conversation

@quiet-node
Copy link
Copy Markdown
Owner

Summary

  • Replaced markdown rendering stack: Swapped marked + DOMPurify + dangerouslySetInnerHTML with react-markdown + remark-gfm. This eliminates the dangerouslySetInnerHTML ESLint warning by design — react-markdown renders markdown as React elements via createElement, never touching innerHTML. Raw HTML in markdown source is stripped by default, removing the XSS surface without needing an external sanitizer.
  • Added stable message keys: Added id: string to the Message interface, generated via crypto.randomUUID() on each message creation. ConversationView now uses msg.id as the React key, fixing the array-index-as-key ESLint warning.
  • Added GFM support: The remark-gfm plugin enables GitHub Flavored Markdown (tables, strikethrough, task lists, autolinks) out of the box.

Dependencies changed

Added Removed
react-markdown marked
remark-gfm dompurify
@types/marked
@types/dompurify

Test plan

  • bun run lint — 0 errors, 0 warnings (was 2 warnings before)
  • bun run format:check — all files pass
  • bun run typecheck — no type errors
  • bun run test:coverage — 137 tests pass, 100% coverage on all metrics
  • Manual: verify markdown rendering in chat bubbles (bold, italic, code blocks, lists, tables, links)
  • Manual: verify LLM streaming still renders smoothly token-by-token

🤖 Generated with Claude Code

…age keys

Replace the marked + DOMPurify + dangerouslySetInnerHTML markdown pipeline
with react-markdown, which renders markdown as React elements directly —
eliminating the XSS surface and the ESLint dangerouslySetInnerHTML warning.
Add unique IDs to Message objects to fix the array-index-as-key warning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@quiet-node quiet-node force-pushed the worktree-fix-build-warnings branch from 783296b to 85438f8 Compare March 31, 2026 21:32
@quiet-node quiet-node merged commit 2d620ec into main Mar 31, 2026
3 checks passed
@quiet-node quiet-node deleted the worktree-fix-build-warnings branch March 31, 2026 21:39
quiet-node added a commit that referenced this pull request Apr 10, 2026
… keys (#9)

fix: replace marked+DOMPurify with react-markdown and add stable message keys

Replace the marked + DOMPurify + dangerouslySetInnerHTML markdown pipeline
with react-markdown, which renders markdown as React elements directly —
eliminating the XSS surface and the ESLint dangerouslySetInnerHTML warning.
Add unique IDs to Message objects to fix the array-index-as-key warning.
quiet-node added a commit that referenced this pull request Apr 10, 2026
… keys (#9)

fix: replace marked+DOMPurify with react-markdown and add stable message keys

Replace the marked + DOMPurify + dangerouslySetInnerHTML markdown pipeline
with react-markdown, which renders markdown as React elements directly —
eliminating the XSS surface and the ESLint dangerouslySetInnerHTML warning.
Add unique IDs to Message objects to fix the array-index-as-key warning.
quiet-node added a commit that referenced this pull request Apr 11, 2026
… keys (#9)

fix: replace marked+DOMPurify with react-markdown and add stable message keys

Replace the marked + DOMPurify + dangerouslySetInnerHTML markdown pipeline
with react-markdown, which renders markdown as React elements directly —
eliminating the XSS surface and the ESLint dangerouslySetInnerHTML warning.
Add unique IDs to Message objects to fix the array-index-as-key warning.
This was referenced Apr 11, 2026
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.

1 participant