feat(ui): render release notes toast with markdown and visible scroll#538
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 (4)
✨ 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 implements markdown-to-HTML conversion for release notes in toasts, adding a new markdownHtml property, a parsing utility, and DOMPurify sanitization. Feedback highlights a logic error in the markdown parser that prevents correct list rendering when mixed with other text, suggests adding single-quote escaping to the escapeHtml function for better security, and notes that several CSS rules for headers and bold text are currently unused by the parser.
- Add markdownHtml option to ToastOptions for pre-converted HTML content - Render markdown bullet lists as <ul><li> in release notes toast - Show thin scrollbar (scrollbar-width: thin) instead of hidden - Fix gap: 2px -> 6px in toast-content for 4pt grid compliance - Remove pre-line whitespace override; markdown slot handles formatting - Update highlights.tsx to convert description to HTML before passing - Update E2E selectors from toast-description to toast-markdown slot
ecdb8e1 to
be06b8e
Compare
Summary
<ul><li>) instead ofpre-lineplain textscrollbar-width: none)gap: 2pxtogap: 6pxin toast content area (4pt grid compliance)white-space: pre-lineoverride; markdown slot handles formattingWhy
Release notes toast content was cramped, not obviously scrollable, and markdown formatting was not rendered. The
subtlevariant usedwhite-space: pre-linewhich only preserves newlines but does not render- bulletas actual list items. The scrollbar was hidden (scrollbar-width: none), making it impossible for users to discover they can scroll long content.Implementation
Because
markdown.tsxrequiresuseMarked()context (unavailable inside Kobalte'stoaster.show()render root), we use aninnerHTMLapproach:highlights.tsx: newbuildToastMarkdownHtml()converts the existingbuildToastDescription()output (bullet lines prefixed with•) to<ul><li>HTML. Content is HTML-escaped byescapeHtml()before insertion.toast.tsx: newmarkdownHtml?: stringfield inToastOptions;DOMPurify.sanitize()applied at render time as a second-layer defense. Existingdescriptionpath is unchanged.toast-descriptiontotoast-markdownslot; bullet assertions drop the•prefix since text is now in<li>elements.Human Review Status
Pending. A human should make the final merge decision after reviewing the diff and verification evidence.
Review Focus
toast.tsx: newmarkdownHtmlfield andDOMPurify.sanitize()at rendertoast.css: scrollbar-width change, gap fix, new[data-slot="toast-markdown"]blockhighlights.tsx:buildToastMarkdownHtml()converter and call-site changeRisk Notes
markdownHtmlcontent is HTML-escaped viaescapeHtml()before conversion; DOMPurify in toast.tsx is a second layermarkdownHtmlset are affected; existingdescriptionpath is unchangedscrollbar-width: thinshows system scrollbar on Windows/Linux; on macOS it shows on hover — no layout impactbuildToastDescriptionis kept as-is (all 22 unit tests pass); only the call site changesHow To Verify
Checklist
buildToastDescriptionand its 22 unit tests are untoucheddev; title and commit use Conventional Commits in English