From 89c3fa05d94893324a99f655d3afd00c2048f8e2 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Tue, 16 Oct 2018 18:41:42 +0100 Subject: [PATCH] Ensure line-breaks get standardised when using via `line` method As noted in https://github.com/erusev/parsedown/pull/624 there are occasions where line break standardisation is assumed (e.g. where `inlineCode` replaces line breaks with a space). Closes #624 --- Parsedown.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Parsedown.php b/Parsedown.php index 9008a89..c11adff 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -1119,6 +1119,9 @@ class Parsedown protected function lineElements($text, $nonNestables = array()) { + # standardize line breaks + $text = str_replace(array("\r\n", "\r"), "\n", $text); + $Elements = array(); $nonNestables = (empty($nonNestables)