Markdown table columns don't wrap text — grow to fit content instead
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 2.1k
- Fork
- 153
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## 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.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.