Skip to content

Commit

Permalink
Merge pull request #587 from Crozzers/fix-assertionerror-issue584
Browse files Browse the repository at this point in the history
Fix `AssertionError` on malformed HTML (#584)
  • Loading branch information
nicholasserra authored Jul 5, 2024
2 parents c6b69f4 + d593b81 commit adfc3fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def _hash_html_block_sub(
tag = None

if not tag:
m = re.match(r'.*?<(\S).*?>', html)
m = re.match(r'.*?<(\S).*?\s*>', html)
# tag shouldn't be none but make the assertion for type checker
assert m is not None
tag = m.group(1)
Expand Down
3 changes: 3 additions & 0 deletions test/tm-cases/malformed_html_crash_issue584.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
</p
>
<pre>
3 changes: 3 additions & 0 deletions test/tm-cases/malformed_html_crash_issue584.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
</p
>
<pre>

0 comments on commit adfc3fc

Please sign in to comment.