Skip to content

Commit

Permalink
Merge pull request #337 from gholker/fix-empty-list-item
Browse files Browse the repository at this point in the history
Handle empty list item
  • Loading branch information
lepture authored Mar 22, 2023
2 parents e57920e + 8a66fe6 commit b79ec36
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 b79ec36

Please sign in to comment.