From b3ac4606a6697c97a08c09dc3c54d98af84eaf59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20van=20Delft?= Date: Mon, 15 Feb 2021 16:29:14 +0100 Subject: [PATCH] Allow for the use of backslash for newlines --- markdownify/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 4542f9a..59aa694 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -47,6 +47,7 @@ class MarkdownConverter(object): heading_style = UNDERLINED bullets = '*+-' # An iterable of bullet types. strong_em_symbol = '*' + newline = 'spaces' class Options(DefaultOptions): pass @@ -155,7 +156,10 @@ class MarkdownConverter(object): if convert_as_inline: return "" - return ' \n' + if self.options['newline'] == 'backslash': + return '\\\n' + else: + return ' \n' def convert_em(self, el, text, convert_as_inline): em_tag = self.options['strong_em_symbol']