Markdown table cell tooltip crashes with MarkupError on bracketed text

Open Beginner friendly
#6,642 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
cli

Research direction

Start from the Markdown table path that assigns tooltips during one-shot compose, then inspect Tooltip.update() and compare it with the streaming-row path. Reproduce the provided app with ONE_SHOT enabled and verify that bracketed cell text no longer raises MarkupError while streaming rows remain safe.

Written by the indexing model from the issue text.

Description

Bug

  • Markdown table cell tooltip crashes with MarkupError on bracketed text
  • Textual's Markdown sets table-cell tooltips from cell.plain (a str), which Tooltip.update() renders markup-enabled. Hovering a cell whose text looks like markup (e.g. ([sys:LOCK=SAFE…])) parses it as a key=value tag and raises MarkupError, crashing the TUI.
  • Streaming rows are safe (Content tooltip), one-shot compose is not (str tooltip).

Repro

from __future__ import annotations

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

# True  -> render the table in one shot (compose): tooltip is `cell.plain` (str),
#          rendered markup-enabled -> MarkupError when overing the cell
# False -> render the table by streaming rows (_update_rows): tooltip is a
#          `Content` object, never markup-parsed -> no crash.
ONE_SHOT = True

HEADER = "| session | note |\n| --- | --- |\n"
SAFE_ROW = "| aaa-bbb-ccc | first row padding to force truncation |\n"
BRACKET_ROW = (
    "| 019f314b-d61d-7837-a158-8aac342ae56f "
    "| ([sys:LOCK=SAFE\u2026]) persona override |\n"
)


class ReproApp(App[None]):
    def compose(self) -> ComposeResult:
        yield Markdown("")

    async def on_mount(self) -> None:
        md = self.query_one(Markdown)
        if ONE_SHOT:
            await md.update(HEADER + SAFE_ROW + BRACKET_ROW)
        else:
            stream = Markdown.get_stream(md)
            await stream.write(HEADER + SAFE_ROW)
            await stream.write(BRACKET_ROW)
            await stream.stop()


if __name__ == "__main__":
    ReproApp().run()
Dominant language
Python
Stars
37.3k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Textualize/textual

All issues in Textualize/textual

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.