Repository navigation
fix(pr-comments): make the review sidebar legible for structured bot markdown - #9209
Conversation
📝 WalkthroughWalkthroughCompact Markdown headings now use level-specific classes and accessible heading attributes. Comment body typography changes to 13px with relaxed leading, while Markdown presentation rules cover block spacing, heading sizes, code, tables, subscript/superscript sizing, image alignment, and bold line-break labels. Tests were expanded for these styles and for paragraph rendering inside disclosure elements. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
|
reviewing now! |
…markdown The compact renderer emits <span> for paragraphs and headings, so markdown blocks welded into one inline run and a dead `[&_p]` selector spaced nothing. Bot reviewers (Cursor, Codex, CodeRabbit) now post long structured markdown with heading trees, tables, badges, and severity labels that this panel rendered as an undifferentiated 10-13px wall. Scoped to the PR sidebar via descendant selectors on the body wrapper (the compact renderer is shared by ~20 surfaces, so it stays untouched): - Block flow keyed off every top-level block, so a <details>/<div> between paragraphs no longer collapses the tail spacing to zero. - Type scale matching the document variant already used on the PR page: 13px body, 18/16/15 headings, and bold-then-linebreak section labels promoted to 15px block titles (the shape bots actually use instead of `##` headings). - Code/pre/tables lifted off 10px; nested sub/sup no longer compound to 7px. - Remote images render behind a new opt-in `allowRemoteImages` prop (default off preserves the privacy guard on the other 20 surfaces), honoring the width/height the markup declares, staying inline, and keeping <picture> art-direction intact so badges match GitHub instead of ballooning to @3x.
fe2b0c3 to
d6161e9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a73395be-a866-44ca-9742-b1feda31f05e
📥 Commits
Reviewing files that changed from the base of the PR and between fe2b0c3852a904622ee31d3eecc83db975344e3f and d6161e9.
📒 Files selected for processing (4)
src/renderer/src/components/right-sidebar/pr-comment-presentation.test.tssrc/renderer/src/components/right-sidebar/pr-comment-presentation.tssrc/renderer/src/components/sidebar/CommentMarkdown.test.tsxsrc/renderer/src/components/sidebar/comment-markdown-element-renderers.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/components/right-sidebar/pr-comment-presentation.ts
- src/renderer/src/components/right-sidebar/pr-comment-presentation.test.ts
| h4: ({ children }) => ( | ||
| <span className="comment-md-h font-semibold" role="heading" aria-level={4}> | ||
| {children} | ||
| </span> | ||
| ), | ||
| h5: ({ children }) => ( | ||
| <span className="comment-md-h font-semibold" role="heading" aria-level={5}> | ||
| {children} | ||
| </span> | ||
| ), | ||
| h6: ({ children }) => ( | ||
| <span className="comment-md-h font-semibold" role="heading" aria-level={6}> | ||
| {children} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add level-specific classes for h4–h6.
These renderers omit comment-md-h4, comment-md-h5, and comment-md-h6, so the corresponding heading levels cannot receive distinct presentation styles. Add the level-specific classes and cover at least one of these levels in tests.
Proposed fix
- <span className="comment-md-h font-semibold" role="heading" aria-level={4}>
+ <span className="comment-md-h comment-md-h4 font-semibold" role="heading" aria-level={4}>
...
- <span className="comment-md-h font-semibold" role="heading" aria-level={5}>
+ <span className="comment-md-h comment-md-h5 font-semibold" role="heading" aria-level={5}>
...
- <span className="comment-md-h font-semibold" role="heading" aria-level={6}>
+ <span className="comment-md-h comment-md-h6 font-semibold" role="heading" aria-level={6}>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| h4: ({ children }) => ( | |
| <span className="comment-md-h font-semibold" role="heading" aria-level={4}> | |
| {children} | |
| </span> | |
| ), | |
| h5: ({ children }) => ( | |
| <span className="comment-md-h font-semibold" role="heading" aria-level={5}> | |
| {children} | |
| </span> | |
| ), | |
| h6: ({ children }) => ( | |
| <span className="comment-md-h font-semibold" role="heading" aria-level={6}> | |
| {children} | |
| h4: ({ children }) => ( | |
| <span className="comment-md-h comment-md-h4 font-semibold" role="heading" aria-level={4}> | |
| {children} | |
| </span> | |
| ), | |
| h5: ({ children }) => ( | |
| <span className="comment-md-h comment-md-h5 font-semibold" role="heading" aria-level={5}> | |
| {children} | |
| </span> | |
| ), | |
| h6: ({ children }) => ( | |
| <span className="comment-md-h comment-md-h6 font-semibold" role="heading" aria-level={6}> | |
| {children} | |
| </span> | |
| ), |
…markdown (stablyai#9209) Restore readable block flow, typography, nested spacing, and heading semantics for structured review Markdown in the PR sidebar. Preserve the compact renderer's existing remote-image trust boundary.
Summary
Bot reviewers post long structured Markdown, but the review sidebar rendered compact paragraph and heading spans as a nearly undifferentiated inline wall. This restores scan-friendly hierarchy without changing the shared compact renderer's layout on its other consumers.
role="heading"andaria-levelwhile retaining span flow on other compact surfaces.Screenshots
Original typography comparison (the remote badges visible in this exploratory capture are not loaded by the final patch):
Testing
pnpm typecheck:has()selectorsAI Review Report
Four adversarial review passes covered UI/design-system behavior, accessibility, Markdown renderer/security boundaries, regression risk, and test adequacy. Findings fixed during review:
srcSetvalidation bypass by retaining the existing click-to-open remote-image guard.The final review pass was clean from all three independent reviewers.
Security Audit
Remote compact images remain links and are not fetched automatically. Only the existing trusted
blob:and constrained base64 image sources render inline, so this PR does not widen the renderer's network or sanitization trust boundary.Notes
The full
pnpm lintcommand reaches two failures that are already present unchanged on currentmain: switch-exhaustiveness errors in unrelated native-chat/skills files and an append-only bundled-skill snapshot failure. The PR's changed files and all applicable scoped gates are clean.