Skip to content

Commit da56f7f

Browse files
authored
Merge pull request #53 from Hozhyi/fix/bullet_list_tags_in_separate_lines
Fixed issue #52 - added stripping of text to list
2 parents dbd9f3f + 8400b39 commit da56f7f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

markdownify/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def convert_li(self, el, text, convert_as_inline):
314314
el = el.parent
315315
bullets = self.options['bullets']
316316
bullet = bullets[depth % len(bullets)]
317-
return '%s %s\n' % (bullet, text or '')
317+
return '%s %s\n' % (bullet, (text or '').strip())
318318

319319
def convert_p(self, el, text, convert_as_inline):
320320
if convert_as_inline:

tests/test_lists.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ def test_nested_ols():
5151

5252
def test_ul():
5353
assert md('<ul><li>a</li><li>b</li></ul>') == '* a\n* b\n'
54+
assert md("""<ul>
55+
<li>
56+
a
57+
</li>
58+
<li> b </li>
59+
<li> c
60+
</li>
61+
</ul>""") == '* a\n* b\n* c\n'
5462

5563

5664
def test_inline_ul():

0 commit comments

Comments
 (0)