diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 148d340..28cdaf6 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -475,12 +475,12 @@ def _indent_for_blockquote(match): def convert_br(self, el, text, parent_tags): if '_inline' in parent_tags: - return ' ' + return text + ' ' if text else ' ' if self.options['newline_style'].lower() == BACKSLASH: - return '\\\n' + return '\\\n' + text else: - return ' \n' + return ' \n' + text def convert_code(self, el, text, parent_tags): if '_noformat' in parent_tags: diff --git a/tests/test_conversions.py b/tests/test_conversions.py index dd99dfb..c95483c 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -81,6 +81,9 @@ def test_br(): 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 |' + # html.parser may nest text inside
when mixing
and
; text must not be lost + assert md('a
b
c') == 'a \nb \nc' + assert md('a
b
c', newline_style=BACKSLASH) == 'a\\\nb\\\nc' def test_code():