Markdown table cell tooltip crashes with MarkupError on bracketed text
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Textualize/textual
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Textualize/textual#6713 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Textualize/textual#6712 · 1 comment ·
-
`Selection.extract` IndexError via ordinary mouse selection on built-in widgets (MRE for #6428) Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Textualize/textual#6708 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Textualize/textual#6706 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Textualize/textual#6699 · 6 comments ·
All issues in Textualize/textual
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100