diff --git a/Parsedown.php b/Parsedown.php index 515ccfb7b..e0ce3ac5f 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -420,7 +420,7 @@ protected function blockCommentContinue($Line, array $Block) 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', diff --git a/test/data/fenced_code_block.html b/test/data/fenced_code_block.html index 8bdabba96..ce8dfd0dc 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 cbed8ebb5..9176ef47a 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