diff --git a/src/calibre/utils/html2text.py b/src/calibre/utils/html2text.py index ecb5ddbe35..cb6f73f658 100644 --- a/src/calibre/utils/html2text.py +++ b/src/calibre/utils/html2text.py @@ -17,6 +17,9 @@ def html2text(html): r'<\gspan\g>', html) h2t = HTML2Text() h2t.default_image_alt = _('Unnamed image') + h2t.body_width = 0 + h2t.single_line_break = True + h2t.emphasis_mark = '*' return h2t.handle(html) @@ -27,12 +30,13 @@ def find_tests(): def test_html2text_behavior(self): for src, expected in { - 'test': 'test\n\n', - 'test': '_test_\n\n', - 'other': '[other](http://else.where/other)\n\n', - '': '![Unnamed image](test.jpeg)\n\n', - 'test dest': 'test dest\n\n', - '<>a': '<>a\n\n', + 'test': 'test\n', + 'test': '*test*\n', + 'other': '[other](http://else.where/other)\n', + '': '![Unnamed image](test.jpeg)\n', + 'test dest': 'test dest\n', + '<>a': '<>a\n', + '

a

b': 'a\nb\n', }.items(): self.assertEqual(html2text(src), expected)