in inline contexts, resolve <br/> to a space instead of an empty string (#202)

Signed-off-by: chrispy <chrispy@synopsys.com>
This commit is contained in:
Chris Papademetrious
2025-03-04 07:37:22 -05:00
committed by GitHub
parent 5122c973c1
commit 618747c18c
2 changed files with 3 additions and 1 deletions

View File

@@ -443,7 +443,7 @@ class MarkdownConverter(object):
def convert_br(self, el, text, parent_tags):
if '_inline' in parent_tags:
return ""
return ' '
if self.options['newline_style'].lower() == BACKSLASH:
return '\\\n'

View File

@@ -79,6 +79,8 @@ def test_blockquote_nested():
def test_br():
assert md('a<br />b<br />c') == 'a \nb \nc'
assert md('a<br />b<br />c', newline_style=BACKSLASH) == 'a\\\nb\\\nc'
assert md('<h1>foo<br />bar</h1>', heading_style=ATX) == '\n\n# foo bar\n\n'
assert md('<td>foo<br />bar</td>', heading_style=ATX) == ' foo bar |'
def test_code():