[CodeBlock] Fix token rendering and sub-pixel border
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 70
- Forks
- 13
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 8
Description
Summary
Minor improvements to the CodeBlock component.
Improvements
2. Array index as key in token rendering
Both line and token maps use array index as key. For stable rendering, this is acceptable for static content but could cause issues with dynamic content updates.
3. maxLines off-by-one compensation
The context adds +1 to maxLines ("to compensate for the absolute collapse trigger"). This leaks implementation detail into the API — consumers pass maxLines={5} but 6 lines are stored internally.
4. Sub-pixel border value
Uses border: 0.5px solid in header and collapse trigger styles.
Moved to Cross-Cutting Issues
The following items have been moved to cross-cutting issues that address them across all components:
- Remove !important declarations (#678)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the CodeBlock component and inspect its line and token rendering, maxLines handling, and header and collapse-trigger styles. Confirm the intended stable keys, public maxLines behavior, and border value, then verify the component’s existing checks or tests; done means all three listed improvements are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100