-
Notifications
You must be signed in to change notification settings - Fork 814
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
Markdown widget - hyperlinks does not open browser on click #4738
Comments
It's left to the developer to implement how to open links. If you want links to open a browser you can handle the LinkClicked message. |
Ah, ok! Noted. Thanks for the swift reply. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
The links in Rich work differently. They are handled by the terminal, which typically opens them in a browser. But you can't intercept those links. The links in Textual Markdown offer more flexibility, because an app can intercept them. |
I see. Thanks again! import webbrowser
@on(Markdown.LinkClicked)
def handle_link_clicked(self, event: Markdown.LinkClicked) -> None:
# Open in a new tab, if possible, else in the default browser
webbrowser.open_new_tab(event.href) worked like a charm! 👍 |
Have you checked closed issues? https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed
Yes.
To reproduce:
When running corresponding
rich
-snippet, it does open the url in browser on click.If this is not supported, I will be happy to change it to a feature request.
The text was updated successfully, but these errors were encountered: