Merge pull request #53 from Hozhyi/fix/bullet_list_tags_in_separate_lines

Fixed issue #52 - added stripping of text to list
This commit is contained in:
AlexVonB
2021-09-04 21:48:16 +02:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

@@ -314,7 +314,7 @@ class MarkdownConverter(object):
el = el.parent
bullets = self.options['bullets']
bullet = bullets[depth % len(bullets)]
return '%s %s\n' % (bullet, text or '')
return '%s %s\n' % (bullet, (text or '').strip())
def convert_p(self, el, text, convert_as_inline):
if convert_as_inline:

View File

@@ -51,6 +51,14 @@ def test_nested_ols():
def test_ul():
assert md('<ul><li>a</li><li>b</li></ul>') == '* a\n* b\n'
assert md("""<ul>
<li>
a
</li>
<li> b </li>
<li> c
</li>
</ul>""") == '* a\n* b\n* c\n'
def test_inline_ul():