Skip to content

Commit 0c05438

Browse files
author
Gareth Simpson
committed
Better fix for issue 348
1 parent 9144d0f commit 0c05438

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/markdown2.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2164,11 +2164,14 @@ def _encode_amps_and_angles(self, text):
21642164
text = self._naked_gt_re.sub('>', text)
21652165
return text
21662166

2167-
_incomplete_tags_re = re.compile("<(/?\w+?(?!://).?[\s/]+?)")
2167+
_incomplete_tags_re = re.compile("<(/?\w+?(?!\w).+?[\s/]+?)")
21682168

21692169
def _encode_incomplete_tags(self, text):
21702170
if self.safe_mode not in ("replace", "escape"):
21712171
return text
2172+
2173+
if text.endswith(">"):
2174+
return text # this is not an incomplete tag, this is a link in the form <http://x.y.z>
21722175

21732176
return self._incomplete_tags_re.sub("&lt;\\1", text)
21742177

0 commit comments

Comments
 (0)