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

Implement Emphasis

This commit is contained in:
Aidan Woods
2019-01-20 02:34:41 +00:00
parent f2a3a2fb08
commit 164a39f3e9
2 changed files with 86 additions and 29 deletions

View File

@@ -411,35 +411,6 @@ class Parsedown
return $Elements;
}
protected function inlineEmphasis($Excerpt)
{
if (! isset($Excerpt['text'][1])) {
return;
}
$marker = $Excerpt['text'][0];
if ($Excerpt['text'][1] === $marker and \preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) {
$emphasis = 'strong';
} elseif (\preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) {
$emphasis = 'em';
} else {
return;
}
return [
'extent' => \strlen($matches[0]),
'element' => [
'name' => $emphasis,
'handler' => [
'function' => 'lineElements',
'argument' => $matches[1],
'destination' => 'elements',
]
],
];
}
protected function inlineEscapeSequence($Excerpt)
{
if (isset($Excerpt['text'][1]) and \in_array($Excerpt['text'][1], $this->specialCharacters, true)) {