Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Fixed

- Fixed links in markdown table rows added via `Markdown.append` not being clickable https://github.com/Textualize/textual/issues/6597

## [8.2.8] - 2026-06-30

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/textual/widgets/_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,14 +693,14 @@ def _update_content(self, headers: list[Content], rows: list[list[Content]]):
async def _update_rows(self, updated_rows: list[list[Content]]) -> None:
self.styles.grid_size_columns = len(self.headers)
await self.query_children(f".cell.row{self.last_row}").remove()
new_cells: list[Static] = []
new_cells: list[MarkdownTableCellContents] = []
for row_index, row in enumerate(updated_rows, self.last_row):
for cell in row:
new_cells.append(
Static(
MarkdownTableCellContents(
cell,
classes=f"row{row_index} cell",
).with_tooltip(cell)
).with_tooltip(cell.plain)
)
self.last_row = row_index
await self.mount_all(new_cells)
Expand Down
37 changes: 37 additions & 0 deletions tests/test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,43 @@ def log_markdown_link_clicked(
assert app.messages == ["LinkClicked"]


async def test_link_in_streamed_markdown_table_posts_message_when_clicked():
"""A link inside a table row added via `Markdown.append` should post a
`Markdown.LinkClicked` message when clicked.

Regression test for https://github.com/Textualize/textual/issues/6597
"""

markdown_table = """\
| Textual Links |
| ------------------------------------------------- |
| [GitHub](https://github.com/textualize/textual/) |
"""
appended_row = "| [Documentation](https://textual.textualize.io/) |"

class MarkdownTableApp(App):
messages = []

def compose(self) -> ComposeResult:
yield Markdown(open_links=False)

@on(Markdown.LinkClicked)
def log_markdown_link_clicked(
self,
event: Markdown.LinkClicked,
) -> None:
self.messages.append(event.__class__.__name__)

app = MarkdownTableApp()
async with app.run_test() as pilot:
markdown = app.query_one(Markdown)
await markdown.append(markdown_table)
await markdown.append(appended_row)
await pilot.pause()
await pilot.click(Markdown, offset=(8, 5))
assert app.messages == ["LinkClicked"]


async def test_markdown_quoting():
# https://github.com/Textualize/textual/issues/3350
links = []
Expand Down