[DX-1525]: Collapse long snippets behind a "Show more" toggle#3470
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
umair-ably
left a comment
There was a problem hiding this comment.
1 nit... we can only calculate the height of the code blocks after the page has rendered, which in theory means all pages will load with the code blocks fully expanded, and then instantly redraw them to be collapsed if needed (which could cause a subtle flash or layout shift).
However, I've tested this across several pages in the preview app and it looks perfect - nothing funky spotted
Clip code blocks longer than 15 lines (configurable via collapsedLineCount)
behind a fade-out gradient and a "Show more"/"Show less" toggle. The toggle
is a floating centered pill rather than a full-width bordered bar, so it
never reads as a second footer row when the API key selector sits below it.
Authors can opt out per block with collapse={false}.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2cfafaa to
98c42af
Compare
Description
This PR collapses codeblocks by default if they are above 15 lines long, adding a 'show more' and 'show less' toggle so that it's easy to switch between them.
The intention is to improve the readability of pages with multiple, long codeblocks such as getting started guides.
Checklist