Skip to content

Commit

Permalink
Merge pull request #525 from aidantwoods/fix/infostring
Browse files Browse the repository at this point in the history
Properly support fenced code block infostring
  • Loading branch information
aidantwoods committed Feb 28, 2018
2 parents c192001 + 4404201 commit e941dcc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Parsedown.php
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion test/data/fenced_code_block.html
Expand Up @@ -3,4 +3,5 @@
$message = 'fenced code block';
echo $message;</code></pre>
<pre><code>tilde</code></pre>
<pre><code class="language-php">echo 'language identifier';</code></pre>
<pre><code class="language-php">echo 'language identifier';</code></pre>
<pre><code class="language-c#">echo 'language identifier with non words';</code></pre>
4 changes: 4 additions & 0 deletions test/data/fenced_code_block.md
Expand Up @@ -11,4 +11,8 @@ tilde

```php
echo 'language identifier';
```

```c#
echo 'language identifier with non words';
```

0 comments on commit e941dcc

Please sign in to comment.