Skip to content

Commit

Permalink
Merge pull request #384 from fans656/fix-list-parsing
Browse files Browse the repository at this point in the history
fix list parsing edge case
  • Loading branch information
lepture committed Apr 4, 2024
2 parents 29d3120 + bb3374d commit a4037be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mistune/block_parser.py
Expand Up @@ -27,7 +27,7 @@
_LINE_BLANK_END = re.compile(r'\n[ \t]*\n$')
_BLANK_TO_LINE = re.compile(r'[ \t]*\n')

_BLOCK_TAGS_PATTERN = '|'.join(BLOCK_TAGS) + '|' + '|'.join(PRE_TAGS)
_BLOCK_TAGS_PATTERN = '(' + '|'.join(BLOCK_TAGS) + '|' + '|'.join(PRE_TAGS) + ')'
_OPEN_TAG_END = re.compile(HTML_ATTRIBUTES + r'[ \t]*>[ \t]*(?:\n|$)')
_CLOSE_TAG_END = re.compile(r'[ \t]*>[ \t]*(?:\n|$)')
_STRICT_BLOCK_QUOTE = re.compile(r'( {0,3}>[^\n]*(?:\n|$))+')
Expand Down
6 changes: 6 additions & 0 deletions tests/test_misc.py
Expand Up @@ -103,3 +103,9 @@ def test_emsp(self):
result = md('\u2003\u2003foo\nbar\n\n\u2003\u2003foobar')
expected = '<p>\u2003\u2003foo<br />\nbar</p>\n<p>\u2003\u2003foobar</p>'
self.assertEqual(result.strip(), expected)

def test_html_tag_text_following_list(self):
md = mistune.create_markdown(escape=False, hard_wrap=True)
result = md('foo\n- bar\n\ntable')
expected = '<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n<p>table</p>'
self.assertEqual(result.strip(), expected)

0 comments on commit a4037be

Please sign in to comment.