1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Implement Code

This commit is contained in:
Aidan Woods
2019-01-20 02:33:45 +00:00
parent 760945008b
commit 497045d25b
2 changed files with 61 additions and 18 deletions

View File

@ -411,24 +411,6 @@ class Parsedown
return $Elements;
}
protected function inlineCode($Excerpt)
{
$marker = $Excerpt['text'][0];
if (\preg_match('/^(['.$marker.']++)[ ]*+(.+?)[ ]*+(?<!['.$marker.'])\1(?!'.$marker.')/s', $Excerpt['text'], $matches)) {
$text = $matches[2];
$text = \preg_replace('/[ ]*+\n/', ' ', $text);
return [
'extent' => \strlen($matches[0]),
'element' => [
'name' => 'code',
'text' => $text,
],
];
}
}
protected function inlineEmailTag($Excerpt)
{
$hostnameLabel = '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?';