From 044615eff10a16edd80fad93a0c86bb52ec30fb0 Mon Sep 17 00:00:00 2001 From: Viktor Hozhyi Date: Sat, 4 Sep 2021 12:39:30 +0300 Subject: [PATCH 1/4] Fixed issue #52 - added stripping of text to list --- markdownify/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 3d67a49..4d36bd6 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -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: From 5fc1441fe7935af68f4537eabea6dbba158c9e39 Mon Sep 17 00:00:00 2001 From: Viktor Hozhyi Date: Sat, 4 Sep 2021 20:51:08 +0300 Subject: [PATCH 2/4] Added appropriate test --- tests/test_lists.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_lists.py b/tests/test_lists.py index 08c82c7..64158c6 100644 --- a/tests/test_lists.py +++ b/tests/test_lists.py @@ -51,6 +51,14 @@ def test_nested_ols(): def test_ul(): assert md('') == '* a\n* b\n' + assert md("""""") == '* a\n* b\n* c\n' def test_inline_ul(): From 8400b39dd9179c7269dd8db841df14096fc46b17 Mon Sep 17 00:00:00 2001 From: AlexVonB Date: Sat, 4 Sep 2021 21:47:27 +0200 Subject: [PATCH 3/4] remove trailing whitespace to satisfy the linter --- tests/test_lists.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lists.py b/tests/test_lists.py index 64158c6..5a04430 100644 --- a/tests/test_lists.py +++ b/tests/test_lists.py @@ -51,7 +51,7 @@ def test_nested_ols(): def test_ul(): assert md('
  • a
  • b
') == '* a\n* b\n' - assert md("""
    + assert md("""
    • a
    • From 40dd30419c0fb14aae53a30529df1b568a82722e Mon Sep 17 00:00:00 2001 From: AlexVonB Date: Sat, 4 Sep 2021 21:50:05 +0200 Subject: [PATCH 4/4] bump to v0.9.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 467c1fa..6f5d2a3 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read() pkgmeta = { '__title__': 'markdownify', '__author__': 'Matthew Tretter', - '__version__': '0.9.3', + '__version__': '0.9.4', }