Add conversion for hr element

This commit is contained in:
Jiulong Wang
2021-04-28 15:22:24 -07:00
parent 651d5f00e8
commit 5f102d5223
2 changed files with 7 additions and 0 deletions

View File

@@ -269,6 +269,9 @@ class MarkdownConverter(object):
continue
return '\n'.join(text_data)
def convert_hr(self, el, text, convert_as_inline):
return '\n\n---\n\n'
def markdownify(html, **options):
return MarkdownConverter(**options).convert(html)

View File

@@ -307,3 +307,7 @@ def test_strong_em_symbol():
def test_newline_style():
assert md('a<br />b<br />c', newline_style=BACKSLASH) == 'a\\\nb\\\nc'
def test_hr():
assert md('Hello<hr />World') == 'Hello\n\n---\n\nWorld'