Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD links inside a MD table in Markdown Widget do not generate Markdown.LinkClicked when clicked #4683

Closed
dontascii opened this issue Jun 28, 2024 · 2 comments · Fixed by #4686

Comments

@dontascii
Copy link

Problem

When using the Markdown widget, links inside a table are not posting Markdown.LinkClicked events when they are clicked. The links are rendered properly, just not firing Markdown.LinkClicked.

Other links inside the document but outside of a table work as expected.

Expected Outcome:

Links inside tables generate Markdown.LinkClicked events

The following App renders some markdown which includes links inside and outside of a MD table. The links in the table do not generate the LinkClicked event, so no app notification will be displayed.

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


EXAMPLE_MARKDOWN = """
# Markdown Document

[this link works](https://www.textualize.io/)

| [this title link does not work](https://www.textualize.io/) | col1 | col2 |
|-------|------|------|
| [does this one??](https://www.textualize.io/) | i  | wonder |
| foo | bar  | textual | 
"""
class SelectApp(App):
   
    def compose(self) -> ComposeResult:
        yield Markdown(EXAMPLE_MARKDOWN)

    @on(Markdown.LinkClicked)
    async def on_markdown_link_clicked(self, event: Markdown.LinkClicked) -> None:
        self.notify(f"on_markdown_link_clicked  - {event.href}")

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

I've tried this on my windows 11 laptop as well as Ubuntu via wsl. Here are the textual diagnose outputs for both:

Textual Diagnostics for Windows 11

Versions

Name Value
Textual 0.70.0
Rich 13.7.1

Python

Name Value
Version 3.12.1
Implementation CPython
Compiler MSC v.1937 64 bit (AMD64)
Executable c:\Users\Joel.Clegg\source\python\beaz.venv\Scripts\python.exe

Operating System

Name Value
System Windows
Release 11
Version 10.0.22631

Terminal

Name Value
Terminal Application Windows Terminal
TERM Not set
COLORTERM Not set
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=143, height=37
legacy_windows False
min_width 1
max_width 143
is_terminal True
encoding utf-8
max_height 37
justify None
overflow None
no_wrap False
highlight None
markup None
height None

Textual Diagnostics for linux container

Versions

Name Value
Textual 0.58.0
Rich 13.7.1

Python

Name Value
Version 3.10.12
Implementation CPython
Compiler GCC 11.4.0
Executable /mnt/c/Users/Joel.Clegg/source/python/beaz/.env/bin/python3

Operating System

Name Value
System Linux
Release 5.15.153.1-microsoft-standard-WSL2
Version #1 SMP Fri Mar 29 23:14:13 UTC 2024

Terminal

Name Value
Terminal Application Windows Terminal
TERM xterm-256color
COLORTERM Not set
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=132, height=33
legacy_windows False
min_width 1
max_width 132
is_terminal True
encoding utf-8
max_height 33
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant