Converts URLs in a string to clickable links by wrapping them in an <a>
tag. It identifies URLs that begin with http://
, https://
, or www
. It also converts syntactically valid email addresses.
Variable
html = '''Check out our Python training at https://www.webucator.com/programming-training/python-training.cfm. If you have any questions, email sales@webucator.com.'''
Template
{{ html|urlize }}
Result
Check out our Python training at <a href="https://www.webucator.com/programming-training/python-training.cfm" rel="nofollow">https://www.webucator.com/programming-training/python-training.cfm</a>. If you have any questions, email <a href="mailto:sales@webucator.com">sales@webucator.com</a>.
The generated links will be nofollow links.
Warning
According to the official documentation, this filter does not play nice with text already marked up as HTML.
Commentary
This would be more useful if it could be applied safely to text already marked up as HTML.