From 5f102d5223bed81f3540a3a7b23997eb10f87a50 Mon Sep 17 00:00:00 2001 From: Jiulong Wang Date: Wed, 28 Apr 2021 15:22:24 -0700 Subject: [PATCH] Add conversion for hr element --- markdownify/__init__.py | 3 +++ tests/test_conversions.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 0b2a620..eeaaf74 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -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) diff --git a/tests/test_conversions.py b/tests/test_conversions.py index 6dcf9a6..fcb9bf3 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -307,3 +307,7 @@ def test_strong_em_symbol(): def test_newline_style(): assert md('a
b
c', newline_style=BACKSLASH) == 'a\\\nb\\\nc' + + +def test_hr(): + assert md('Hello
World') == 'Hello\n\n---\n\nWorld'