Skip to content

Markdown tables have strange column widths #6252

@TomJGooding

Description

@TomJGooding

While trying to investigate #6239, I found that the column widths in Markdown tables might be a bit strange.

For example, here's a simple markdown table where all the cells are identical:

Image
from textual.app import App, ComposeResult
from textual.widgets import Markdown

LONG_TEXT = "Lorem ipsum dolor sit amet"

MARKDOWN = f"""
| Header 1    | Header 2    | Header 3    | Header 4    |
|-------------|------------ |-------------|-------------|
| {LONG_TEXT} | {LONG_TEXT} | {LONG_TEXT} | {LONG_TEXT} |
"""


class ExampleApp(App):
    CSS = """
    Markdown { max-width: 88; }
    """

    def compose(self) -> ComposeResult:
        yield Markdown(MARKDOWN)


if __name__ == "__main__":
    app = ExampleApp()
    app.run()

I

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions