Make linkify regex work with port in URL

This commit is contained in:
miruka 2019-08-21 14:22:34 -04:00
parent d2938f8730
commit fea2178461

View File

@ -13,9 +13,9 @@ class MarkdownRenderer(mistune.Renderer):
class HtmlFilter:
link_regexes = [re.compile(r, re.IGNORECASE) for r in [
(r"(?P<body>[a-zA-Z\d]+://(?P<host>[a-z\d._-]+)"
(r"(?P<body>[a-zA-Z\d]+://(?P<host>[a-z\d._-]+(?:\:\d+)?)"
r"(?:/[/\-_.,a-z\d%&?;=~]*)?(?:\([/\-_.,a-z\d%&?;=~]*\))?)"),
r"mailto:(?P<body>[a-z0-9._-]+@(?P<host>[a-z0-9_.-]+[a-z]))",
r"mailto:(?P<body>[a-z0-9._-]+@(?P<host>[a-z0-9_.-]+[a-z](?:\:\d+)?))",
r"tel:(?P<body>[0-9+-]+)(?P<host>)",
r"(?P<body>magnet:\?xt=urn:[a-z0-9]+:.+)(?P<host>)",
]]