Skip to content

fix: prevent code block overflow in MarkdownText for long lines#335

Merged
stasel merged 2 commits into
mainfrom
copilot/fix-markdown-code-block-overflow
May 6, 2026
Merged

fix: prevent code block overflow in MarkdownText for long lines#335
stasel merged 2 commits into
mainfrom
copilot/fix-markdown-code-block-overflow

Conversation

Copilot AI commented May 6, 2026

Copy link
Copy Markdown
Contributor

Code fences (```) in interaction bodies caused horizontal overflow and broke the interaction card layout, since <pre> defaults to white-space: pre (no wrapping).

Changes

  • MarkdownText.tsx — register a custom pre renderer in react-markdown's components prop that applies white-space: pre-wrap and overflow-wrap: break-word; style object extracted to a module-level constant to avoid per-render allocation
const preStyle = { whiteSpace: 'pre-wrap' as const, overflowWrap: 'break-word' as const };

// inside components prop:
pre: ({ children }) => <pre style={preStyle}>{children}</pre>,

Copilot AI linked an issue May 6, 2026 that may be closed by this pull request
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-fix-markdo-zg0nba May 6, 2026 12:26 Inactive
@HackYourFutures HackYourFutures temporarily deployed to dojo-copilot-fix-markdo-zg0nba May 6, 2026 12:28 Inactive
Copilot AI changed the title [WIP] Fix code block overflow issue in markdown component fix: prevent code block overflow in MarkdownText for long lines May 6, 2026
Copilot finished work on behalf of stasel May 6, 2026 12:28
Copilot AI requested a review from stasel May 6, 2026 12:28
@stasel stasel marked this pull request as ready for review May 6, 2026 12:34
@stasel stasel requested a review from Aya-Alabrash as a code owner May 6, 2026 12:34
Copilot AI review requested due to automatic review settings May 6, 2026 12:34
@stasel stasel requested a review from sima-milli as a code owner May 6, 2026 12:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the trainee profile’s Markdown rendering to prevent long code-fence lines from causing horizontal overflow that breaks the interaction card layout.

Changes:

  • Add a custom pre renderer to react-markdown that applies wrapping styles (white-space: pre-wrap, overflow-wrap: break-word) to code blocks.
  • Extract the <pre> style object to a module-level constant to avoid re-allocating it on each render.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dojo-security-review

Copy link
Copy Markdown

Security Review — no issues found

Generated by PR Security Review for issue #335 · ● 76.5K ·

@stasel stasel merged commit e64d739 into main May 6, 2026
13 of 18 checks passed
@stasel stasel deleted the copilot/fix-markdown-code-block-overflow branch May 6, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code block (```) in the markdown component overflows with long text

4 participants