From a9dfc97ddc06ca4739630d029bb3d2e16f3efc12 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Thu, 16 Jul 2015 16:56:56 +0300 Subject: [PATCH] opening code fence doesn't need 2 regex groups --- Parsedown.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 660b041..3a2803a 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -386,16 +386,16 @@ class Parsedown protected function blockFencedCode($Line) { - if (preg_match('/^(['.$Line['text'][0].']{3,})[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches)) + if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches)) { $Element = array( 'name' => 'code', 'text' => '', ); - if (isset($matches[2])) + if (isset($matches[1])) { - $class = 'language-'.$matches[2]; + $class = 'language-'.$matches[1]; $Element['attributes'] = array( 'class' => $class,