Skip to content

Commit 618747c

Browse files
authored
in inline contexts, resolve <br/> to a space instead of an empty string (#202)
Signed-off-by: chrispy <[email protected]>
1 parent 5122c97 commit 618747c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: markdownify/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def _indent_for_blockquote(match):
443443

444444
def convert_br(self, el, text, parent_tags):
445445
if '_inline' in parent_tags:
446-
return ""
446+
return ' '
447447

448448
if self.options['newline_style'].lower() == BACKSLASH:
449449
return '\\\n'

Diff for: tests/test_conversions.py

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def test_blockquote_nested():
7979
def test_br():
8080
assert md('a<br />b<br />c') == 'a \nb \nc'
8181
assert md('a<br />b<br />c', newline_style=BACKSLASH) == 'a\\\nb\\\nc'
82+
assert md('<h1>foo<br />bar</h1>', heading_style=ATX) == '\n\n# foo bar\n\n'
83+
assert md('<td>foo<br />bar</td>', heading_style=ATX) == ' foo bar |'
8284

8385

8486
def test_code():

0 commit comments

Comments
 (0)