From 690934309c20bf0e98b1256445851a5110716ba0 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 21 Aug 2020 00:02:15 +0100 Subject: [PATCH] Ensured new-line stripping can handle Windows format --- markdown_include/include.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markdown_include/include.py b/markdown_include/include.py index 8a039fa..5463cd5 100644 --- a/markdown_include/include.py +++ b/markdown_include/include.py @@ -109,13 +109,13 @@ def run(self, lines): # Strip the newline, and optionally increase header depth if self.inheritHeadingDepth or self.headingOffset: if HEADING_SYNTAX.search(text[i]): - text[i] = text[i].rstrip('\n') + text[i] = text[i].rstrip('\r\n') if self.inheritHeadingDepth: text[i] = bonusHeading + text[i] if self.headingOffset: text[i] = '#' * self.headingOffset + text[i] else: - text[i] = text[i].rstrip('\n') + text[i] = text[i].rstrip('\r\n') text[0] = line_split[0] + text[0] text[-1] = text[-1] + line_split[2]