github / github/app

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

Offen
#3,081 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @dmytrostruk Auf GitHub ansehen
Vorherrschende Sprache
Keine Sprachdaten
Sterne
2.1k
Forks
153
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.