-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Allow file:// hyperlinks Fixes #3786 #3788
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
Conversation
This issue needs a solution, since modern LLM tools such as coding agents need to reference local files. This behavior does not allow rich to be a viable python library for such applications
tbung
commented
Jul 14, 2025
Thank you for tackling this! I think it's a bit dumb that that is how it has to be done, but upstream markdown_it
seems to disallow file://
urls to prevent XSS.
Yes, it could also be replaced by a single liner lambda function, but yea sadly the functions needs to get overwritten. It is also possible to do it by post processing, but I find that even messier.
Enable file:// hyperlinks in Rich Fixes #3786
Type of changes
Checklist
Description
This PR fixes an issue where
file://
hyperlinks were not working in Rich due to the underlying markdown-it-py implementation. The markdown-it-py library blocks file:// URLs for security reasons when rendering in browser environments, but this security restriction doesn't apply to Rich since it runs locally.Problem
file://
hyperlinks in Rich markup were not being rendered as clickable linksSolution
file://
URLs when rendering hyperlinksfile://
URL syntaxExample Usage