summaryrefslogtreecommitdiff
path: root/markdown
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2019-08-14 06:23:59 -0700
committerWaylan Limberg <waylan.limberg@icloud.com>2019-08-14 09:23:59 -0400
commit97c1edd5d0aba8b09afcf836777acc6935ed88e2 (patch)
tree1f4a48dcef89b97875d4b25ce047991ab4285957 /markdown
parent7eeb133f1f1b3594d300b8918e84b746e35809c8 (diff)
downloadpython-markdown-97c1edd5d0aba8b09afcf836777acc6935ed88e2.tar.gz
Optimize HTML_RE from quadratic time to linear (#804)
Remove misleading escaped_chars_in_js test Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'markdown')
-rw-r--r--markdown/inlinepatterns.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 74cda18..23f7c5a 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -153,7 +153,7 @@ AUTOLINK_RE = r'<((?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^<>]*)>'
AUTOMAIL_RE = r'<([^<> !]*@[^@<> ]*)>'
# <...>
-HTML_RE = r'(\<([a-zA-Z/][^\>]*?|\!--.*?--)\>)'
+HTML_RE = r'(<([a-zA-Z/][^<>]*|!--(?:(?!<!--|-->).)*--)>)'
# "&#38;" (decimal) or "&#x26;" (hex) or "&amp;" (named)
ENTITY_RE = r'(&(?:\#[0-9]+|\#x[0-9a-fA-F]+|[a-zA-Z0-9]+);)'