github / github/app

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

Ouverte
#3,081 0 commentaires 0 réactions 1 personne assignée Réclamée par @dmytrostruk Voir sur GitHub
Langage dominant
Aucune donnée de langage
Étoiles
2.1k
Forks
153
Métriques de merge des PR
Aucune PR mergée en 30 j

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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.