Skip to content

🐛 FIX: Combination of blockquotes, list and newlines causes IndexError #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2022
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
2 changes: 0 additions & 2 deletions markdown_it/rules_block/blockquote.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,4 @@ def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool):

state.blkIndent = oldIndent

state.lineMax += 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


return True
3 changes: 1 addition & 2 deletions markdown_it/rules_block/state_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ def skipEmptyLines(self, from_pos: int) -> int:
]:
break
except IndexError:
from_pos += 1
Copy link
Contributor Author

@hukkin hukkin Apr 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This increment seems like a porting error of the JS for loop so removing it. Actually the break statement seems incorrect here. Using pass now to emulate a falsy condition of the if statement.

break
pass
from_pos += 1
return from_pos

Expand Down
21 changes: 21 additions & 0 deletions tests/test_port/fixtures/commonmark_extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -673,3 +673,24 @@ Issue #205. Space in link destination generates IndexError
<p>[Contact](http:// mail.com)</p>
<p>[Contact](mailto: [email protected])</p>
.

Issue #204. Combination of blockquotes, list and newlines causes an IndexError
.
> QUOTE
+ UNORDERED LIST ITEM
> INDENTED QUOTE



.
<blockquote>
<p>QUOTE</p>
</blockquote>
<ul>
<li>UNORDERED LIST ITEM
<blockquote>
<p>INDENTED QUOTE</p>
</blockquote>
</li>
</ul>
.