-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
This is a bit of an edge case I encountered while rendering a README file. I was able to remove irrelevant parts, until just this was left:
> QUOTE\n
+ UNORDERED LIST ITEM\n
> INDENTED QUOTE\n
\n\n
This causes an IndexError. Removing any one of the three rows with content causes the example to work as expected. Also removing on or more newlines from the end causes the example to work. It's just this combination that causes problems.
Reproduce the bug
from markdown_it import MarkdownIt
md = MarkdownIt("gfm-like")
md.render("> QUOTE\n+ UNORDERED LIST ITEM\n > INDENTED QUOTE\n\n\n")
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/venv/lib/python3.8/site-packages/markdown_it/main.py", line 275, in render
return self.renderer.render(self.parse(src, env), self.options, env)
File "/venv/lib/python3.8/site-packages/markdown_it/main.py", line 260, in parse
self.core.process(state)
File "/venv/lib/python3.8/site-packages/markdown_it/parser_core.py", line 33, in process
rule(state)
File "/venv/lib/python3.8/site-packages/markdown_it/rules_core/block.py", line 14, in block
state.md.block.parse(
File "/venv/lib/python3.8/site-packages/markdown_it/parser_block.py", line 107, in parse
self.tokenize(state, state.line, state.lineMax)
File "/venv/lib/python3.8/site-packages/markdown_it/parser_block.py", line 77, in tokenize
if rule(state, line, endLine, False):
File "/venv/lib/python3.8/site-packages/markdown_it/rules_block/list.py", line 272, in list_block
prevEmptyEnd = (state.line - startLine) > 1 and state.isEmpty(state.line - 1)
File "/venv/lib/python3.8/site-packages/markdown_it/rules_block/state_block.py", line 137, in isEmpty
return (self.bMarks[line] + self.tShift[line]) >= self.eMarks[line]
IndexError: list index out of range
List your environment
- Python 3.8.10
- markdown-it-py 1.1.0 (also occurs on 2.0.1)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working