github / github/app

Markdown table columns don't wrap text — grow to fit content instead

Open
#3,081 0 comments 0 reactions 1 assignee Claimed by @dmytrostruk View on GitHub
Dominant language
No language data
Stars
2.1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

## Summary

When a markdown table is rendered in the app (e.g., in a conversation, the editor canvas, or file preview), cells with long content (long descriptions, unbroken URLs, etc.) do not wrap their text. Instead, the column grows wider to fit the content, and if a table has multiple such columns, the whole table becomes extremely wide, requiring horizontal scrolling instead of wrapping.

## Root cause (double-check this)

In `src/components/MarkdownContent/MarkdownContent.module.css`, the `.table` class sets `width: 100%` but has no `table-layout: fixed`. Without `table-layout: fixed`, the browser sizes columns based on intrinsic content width (auto layout) before any wrapping is considered, so long unbroken tokens push columns wider rather than wrapping. The `.tableScroller` wrapper's `overflow-x: auto` then just allows horizontal scrolling instead of wrapping. The `overflow-wrap: anywhere` set on `.root` doesn't help because it never gets a chance to apply — the column has already expanded.

## Suggested fix

Add `table-layout: fixed;` to the `.table` rule, and add `white-space: normal; overflow-wrap: anywhere; word-break: break-word;` to `.tableHeader, .tableCell` so wrapping works reliably even for long unbroken strings like URLs.

## Repro steps

1. Render a markdown table with a column containing a long sentence and another column containing a long unbroken URL (no spaces/hyphens).
2. Observe that the table becomes very wide instead of wrapping the cell text onto multiple lines.

## Expected behavior

Table stays within the available width; cell text wraps onto multiple lines like a normal paragraph.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.