AssertionError: assert re.match(r'^<(?:ul|ol).*?>', cuddled_list) when two list items are on the same line
edufresne opened this issue · 2 comments
Describe the bug
The cuddled list extra seems to crash with the following error:
Traceback (most recent call last):
File "/.venv/lib/python3.11/site-packages/markdown2.py", line 411, in convert
text = self._run_block_gamut(text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/markdown2.py", line 1172, in _run_block_gamut
text = self._form_paragraphs(text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/markdown2.py", line 2570, in _form_paragraphs
assert re.match(r'^<(?:ul|ol).*?>', cuddled_list)
AssertionError
when passed text to convert that has two list items on the same line.
To Reproduce
markdown_input = '- - Test'
markdowner = markdown2.Markdown(
tab_width=2, extras=["tables", "break-on-newline", "fenced-code-blocks", "strike", "cuddled-lists"]
)
markdowner.convert(markdown_input)
Expected behavior
That this would not raise an assertion error and would parse out to someting like:
<ul>
<li>
<ul>
<li>Test</li>
</ul>
</li>
</ul>
Debug info
Latest: 2.4.13
Any extras being used:
"tables", "break-on-newline", "fenced-code-blocks", "strike", "cuddled-lists"
Additional context
Also, looking at the test suite, the not_quite_a_list
test case should catch this but looks to be passing as the most recent build: https://github.com/trentm/python-markdown2/actions/runs/8789672182/job/24119927692. Taking the input .txt
file from that test case and running against it locally also reproduces the assertion error.