Skip to content

Markdown list items get extra blank lines in grid with Horizontal sibling #6363

@fabge

Description

@fabge

Checked closed issues — no duplicates found. Running latest Textual (7.5.0).

The bug

Markdown list items render with extra blank lines between them when a Horizontal container (with a child) is a sibling in a CSS grid that has both explicit grid-columns and grid-rows.

Expected: compact list — no blank lines between bullet items.
Actual: blank line between items.

Minimal reproduction

from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Markdown, Static

MD = "- one\n- two\n- three\n- four\n- five"

class BugDemo(App):
    CSS = \"\"\"
    Screen {
        layout: grid;
        grid-size: 2 2;
        grid-columns: 1fr 1fr;
        grid-rows: 1fr 1fr;
    }
    Horizontal { height: 1fr; }
    \"\"\"
    BINDINGS = [("q", "quit")]
    def compose(self) -> ComposeResult:
        yield Markdown(MD)
        yield Horizontal(Static("hi"))

BugDemo().run()

Output

  • one                                 hi
  • two

  • three
  • four

  • five

Trigger conditions (all required)

  • CSS grid with both grid-columns and grid-rows set
  • Markdown as a direct grid child
  • Horizontal with a child widget as a sibling grid child

Any of these make the list render correctly

  • Remove grid-columns or grid-rows
  • Replace Horizontal with Vertical
  • Use an empty Horizontal()

Textual Diagnostics

Versions

Name Value
Textual 7.5.0
Rich 14.3.2

Python

Name Value
Version 3.13.9
Implementation CPython

Operating System

Name Value
System Darwin
Release 25.3.0

Terminal

Name Value
Terminal Application ghostty (1.2.3)
TERM xterm-ghostty
COLORTERM truecolor

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