Skip to content

Commit

Permalink
Handle empty list item
Browse files Browse the repository at this point in the history
  • Loading branch information
graham-cmb committed Mar 18, 2023
1 parent e57920e commit 8a66fe6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mistune/renderers/_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def _render_list_item(renderer, parent, item, state):
text += renderer.render_token(tok, state)

lines = text.splitlines()
text = lines[0] + '\n'
text = (lines[0] if lines else '') + '\n'
prefix = ' ' * len(leading)
for line in lines[1:]:
if line:
Expand Down
8 changes: 8 additions & 0 deletions tests/fixtures/renderer_markdown.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,11 @@ hello

2. item 2
````````````````````````````````

```````````````````````````````` example
- list
-
.
- list
-
````````````````````````````````

0 comments on commit 8a66fe6

Please sign in to comment.