From 1d61f90bf94a5a27736208275dae6d93c79107b8 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 13 Oct 2016 19:47:06 +0200 Subject: [PATCH] Support list items starting with indented code --- Parsedown.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Parsedown.php b/Parsedown.php index df79c99..2f81b84 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -506,7 +506,12 @@ class Parsedown if (preg_match('/^('.$pattern.'([ ]+|$))(.*)/', $Line['text'], $matches)) { - if ($matches[2] === '') { + $contentIndent = strlen($matches[2]); + if ($contentIndent >= 5) { + $contentIndent -= 1; + $matches[1] = substr($matches[1], 0, -$contentIndent); + $matches[3] = str_repeat(' ', $contentIndent) . $matches[3]; + } elseif ($contentIndent === 0) { $matches[1] .= ' '; }