Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [pull #559] Allow cuddled tables (#557)
- [pull #560] Fix `markdown-in-html` not always splitting HTML tags into separate lines (#558)
- [pull #564] Fix incomplete comments in safe mode not being escaped (#563)


## python-markdown2 2.4.12
Expand Down
2 changes: 1 addition & 1 deletion lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2639,7 +2639,7 @@ def _encode_amps_and_angles(self, text):
text = self._naked_gt_re.sub('>', text)
return text

_incomplete_tags_re = re.compile(r"<(/?\w+?(?!\w)\s*?.+?[\s/]+?)")
_incomplete_tags_re = re.compile(r"<(!--|/?\w+?(?!\w)\s*?.+?[\s/]+?)")

def _encode_incomplete_tags(self, text):
if self.safe_mode not in ("replace", "escape"):
Expand Down
2 changes: 2 additions & 0 deletions test/tm-cases/basic_safe_mode_escape.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
<p>&lt;div&gt;yowzer!&lt;/div&gt;</p>

<p>blah</p>

<p><em>foo</em> &lt;!-- <em>bar</em></p>
3 changes: 3 additions & 0 deletions test/tm-cases/basic_safe_mode_escape.text
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ blah <img src="dangerous"> blah
<div>yowzer!</div>

blah


*foo* <!-- *bar*