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

Implement Markup

This commit is contained in:
Aidan Woods
2019-01-20 02:29:05 +00:00
parent edc004f503
commit ee094cb397
2 changed files with 89 additions and 39 deletions

View File

@ -334,45 +334,6 @@ class Parsedown
return $Block;
}
#
# Markup
protected function blockMarkup(Context $Context)
{
if ($this->markupEscaped or $this->safeMode) {
return;
}
if (\preg_match('/^<[\/]?+(\w*)(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+(\/)?>/', $Context->line()->text(), $matches)) {
$element = \strtolower($matches[1]);
if (\in_array($element, $this->textLevelElements, true)) {
return;
}
$Block = [
'name' => $matches[1],
'element' => [
'rawHtml' => $Context->line()->text(),
'autobreak' => true,
],
];
return $Block;
}
}
protected function blockMarkupContinue(Context $Context, array $Block)
{
if (isset($Block['closed']) or $Context->previousEmptyLines() > 0) {
return;
}
$Block['element']['rawHtml'] .= "\n" . $Context->line()->rawLine();
return $Block;
}
#
# Reference