-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Make urlize filter support mailto: scheme #1172
Copy link
Copy link
Closed
Milestone
Description
Expected Behavior
The urlize filter should recognize the mailto: URI scheme and create a corresponding link.
>>> env.from_string('{{ "mailto:[email protected]"|urlize }}').render()
'<a href="mailto:[email protected]" rel="noopener">[email protected]</a>'Actual Behavior
Instead the mail address does not get recognized as an address suitable for an anchor and is not modified by the filter.
>>> env.from_string('{{ "mailto:[email protected]"|urlize }}').render()
'mailto:[email protected]'I already looked into the source code and noticed that urlize is only supported for http(s):// and not other protocols. However I think that albeit being rarer than normal web links mail links or other links should also be supported. E.g. ftp:// and also other schemes like tel:, data: or apt:.
As those would be hard to dynamically locate inside of a space separated string a better alternative would be to add an option to the filter so that it treats the whole passed string as one link naively.
Template Code
{{ "mailto:[email protected]"|urlize }}Your Environment
- Python version: 3.7
- Jinja version: 2.10
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels