refactor(ui): extract markdown render owners#683
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the Markdown component by modularizing its logic into several specialized utility files, including markdown-code-tools.ts, markdown-details.ts, markdown-link-routing.ts, markdown-sanitize.ts, and markdown-task-list.ts. The feedback focuses on preventing invalid nested anchor tags when marking code links and improving the copy button handler with better memory management, i18n safety, and error handling for clipboard operations.
Perf delta summaryComparator: pass
|
Summary
packages/ui/src/components/markdown.tsxby extracting focused internal owners for sanitizing/fallback rendering, code block copy/link decoration, link/image click routing, task-list rewriting, and details state decoration.Markdowncomponent and the existing test helper exports available from./markdown.packages/ui/src/components/markdown.tsxfrom 598 LOC to 185 LOC.Why
Owner lane: #601 message flow.
This is the final file-governance slice for this session. Markdown rendering is part of the message surface and had several unrelated responsibilities in one large component file. This PR makes that file reviewable without changing runtime behavior or package exports.
Related Issue
Related to #601 and #638.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
packages/ui/src/components/markdown.tsxand its same-directory internal helpers/tests.Topology
devFile Governed
Primary governed file:
packages/ui/src/components/markdown.tsxSupporting files:
packages/ui/src/components/markdown-sanitize.tspackages/ui/src/components/markdown-code-tools.tspackages/ui/src/components/markdown-link-routing.tspackages/ui/src/components/markdown-task-list.tspackages/ui/src/components/markdown-details.tspackages/ui/src/components/markdown.test.tsBehavior
Behavior intended unchanged. This is a structural extraction only. Public component usage remains
Markdownfrom@opencode-ai/ui/markdown, and existing helper exports used by tests remain re-exported from./markdown.Tests Locking Behavior
The focused behavior tests cover:
Testing Gap
No browser screenshot or Electron manual check was run because this PR is a same-behavior refactor of markdown internals with no intended visual, copy, route, IPC, or desktop shell change. Reviewers should still visually scan a rendered long assistant message if they want extra confidence in CSS/DOM parity.
Architecture Effect
markdown.tsx598 -> 185../markdownhelper exports remain available.Risk Notes
Behavior unchanged claim depends on the helper wiring preserving decorator order. The focused tests cover the highest-risk extracted behavior, but they do not replace a visual review of rendered markdown in the full app.
How To Verify
Screenshots or Recordings
Not run. No intended visible UI, copy, style, route, or desktop shell behavior change.
Checklist
dev, and my PR title and commit messages use Conventional Commits in English