Merge pull request #40 from jiulongw/jiulongw/hr

Add conversion for hr element
This commit is contained in:
AlexVonB
2021-05-02 10:47:32 +02:00
committed by GitHub
2 changed files with 6 additions and 1 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

@@ -229,7 +229,9 @@ def test_hn_nested_img():
def test_hr():
assert md('<hr>hr</hr>') == 'hr'
assert md('Hello<hr>World') == 'Hello\n\n---\n\nWorld'
assert md('Hello<hr />World') == 'Hello\n\n---\n\nWorld'
assert md('<p>Hello</p>\n<hr>\n<p>World</p>') == 'Hello\n\n\n\n\n---\n\n\nWorld\n\n'
def test_head():