diff --git a/Parsedown.php b/Parsedown.php index f5dd0fa..00f61f3 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -396,7 +396,7 @@ class Parsedown protected function blockFencedCode($Line) { - if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches)) + if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) { $Element = array( 'name' => 'code', @@ -515,10 +515,10 @@ class Parsedown ), ); - if($name === 'ol') + if($name === 'ol') { $listStart = stristr($matches[0], '.', true); - + if($listStart !== '1') { $Block['element']['attributes'] = array('start' => $listStart); diff --git a/test/data/fenced_code_block.html b/test/data/fenced_code_block.html index 8bdabba..ce8dfd0 100644 --- a/test/data/fenced_code_block.html +++ b/test/data/fenced_code_block.html @@ -3,4 +3,5 @@ $message = 'fenced code block'; echo $message;
tilde
-echo 'language identifier';
\ No newline at end of file
+echo 'language identifier';
+echo 'language identifier with non words';
\ No newline at end of file
diff --git a/test/data/fenced_code_block.md b/test/data/fenced_code_block.md
index cbed8eb..9176ef4 100644
--- a/test/data/fenced_code_block.md
+++ b/test/data/fenced_code_block.md
@@ -11,4 +11,8 @@ tilde
```php
echo 'language identifier';
+```
+
+```c#
+echo 'language identifier with non words';
```
\ No newline at end of file