mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
opening code fence doesn't need 2 regex groups
This commit is contained in:
parent
28774a4359
commit
a9dfc97ddc
@ -386,16 +386,16 @@ class Parsedown
|
|||||||
|
|
||||||
protected function blockFencedCode($Line)
|
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(
|
$Element = array(
|
||||||
'name' => 'code',
|
'name' => 'code',
|
||||||
'text' => '',
|
'text' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($matches[2]))
|
if (isset($matches[1]))
|
||||||
{
|
{
|
||||||
$class = 'language-'.$matches[2];
|
$class = 'language-'.$matches[1];
|
||||||
|
|
||||||
$Element['attributes'] = array(
|
$Element['attributes'] = array(
|
||||||
'class' => $class,
|
'class' => $class,
|
||||||
|
Loading…
Reference in New Issue
Block a user