From aae9c8fe91e8affe95274b150206199ec9688a2b Mon Sep 17 00:00:00 2001 From: chrispy Date: Sun, 2 Mar 2025 09:40:09 -0500 Subject: [PATCH] in inline contexts, resolve
to a space instead of an empty string Signed-off-by: chrispy --- markdownify/__init__.py | 2 +- tests/test_conversions.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 69ec328..ac34ee5 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -443,7 +443,7 @@ def _indent_for_blockquote(match): def convert_br(self, el, text, parent_tags): if '_inline' in parent_tags: - return "" + return ' ' if self.options['newline_style'].lower() == BACKSLASH: return '\\\n' diff --git a/tests/test_conversions.py b/tests/test_conversions.py index 6939329..0df8f57 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -79,6 +79,8 @@ def test_blockquote_nested(): def test_br(): assert md('a
b
c') == 'a \nb \nc' assert md('a
b
c', newline_style=BACKSLASH) == 'a\\\nb\\\nc' + assert md('

foo
bar

', heading_style=ATX) == '\n\n# foo bar\n\n' + assert md('foo
bar', heading_style=ATX) == ' foo bar |' def test_code():