mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
Support up to one level deep of nested parens in urls
(imported from commit 3f314b16a47b5267ddb0d18aa6c5456656895f77)
This commit is contained in:
committed by
Keegan McAllister
parent
191231ab3d
commit
d127d6f19f
@@ -414,7 +414,10 @@ class Bugdown(markdown.Extension):
|
||||
#
|
||||
# This rule must come after the built-in 'link' markdown linkifier to
|
||||
# avoid errors.
|
||||
http_link_regex = r'\b(?P<url>https?://[^\s]+?)(?=[^\w/]*(\s|\Z))'
|
||||
#
|
||||
# We support up to 1 nested pair of paranthesis in a url
|
||||
http_link_regex = r'\b(?P<url>https?://(?:(?:[^\s]+\([^\s)]+?\)[^\s]*?)|[^\s]+?))(?=[^\w/]*(\s|\Z))'
|
||||
|
||||
md.inlinePatterns.add('http_autolink', HttpLink(http_link_regex), '>link')
|
||||
|
||||
# A link starts at a word boundary, and ends at space, punctuation, or end-of-input.
|
||||
|
||||
Reference in New Issue
Block a user