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

Implement Header

This commit is contained in:
Aidan Woods
2019-01-20 02:27:10 +00:00
parent 57c6350184
commit 07c2566042
2 changed files with 84 additions and 33 deletions

View File

@ -334,39 +334,6 @@ class Parsedown
return $Block;
}
#
# Header
protected function blockHeader(Context $Context)
{
$level = \strspn($Context->line()->text(), '#');
if ($level > 6) {
return;
}
$text = \trim($Context->line()->text(), '#');
if ($this->strictMode and isset($text[0]) and $text[0] !== ' ') {
return;
}
$text = \trim($text, ' ');
$Block = [
'element' => [
'name' => 'h' . $level,
'handler' => [
'function' => 'lineElements',
'argument' => $text,
'destination' => 'elements',
]
],
];
return $Block;
}
#
# List