mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Implement IndentedCode
This commit is contained in:
@ -288,52 +288,6 @@ class Parsedown
|
||||
return \method_exists($this, 'block' . $Type . 'Complete');
|
||||
}
|
||||
|
||||
#
|
||||
# Code
|
||||
|
||||
protected function blockCode(Context $Context, $Block = null)
|
||||
{
|
||||
if (isset($Block) and $Block['type'] === 'Paragraph' and ! $Context->previousEmptyLines() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($Context->line()->indent() >= 4) {
|
||||
$Block = [
|
||||
'element' => [
|
||||
'name' => 'pre',
|
||||
'element' => [
|
||||
'name' => 'code',
|
||||
'text' => $Context->line()->ltrimBodyUpto(4),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $Block;
|
||||
}
|
||||
}
|
||||
|
||||
protected function blockCodeContinue(Context $Context, $Block)
|
||||
{
|
||||
if ($Context->line()->indent() >= 4) {
|
||||
if ($Context->previousEmptyLines() > 0) {
|
||||
$Block['element']['element']['text'] .= \str_repeat("\n", $Context->previousEmptyLines());
|
||||
|
||||
unset($Block['interrupted']);
|
||||
}
|
||||
|
||||
$Block['element']['element']['text'] .= "\n";
|
||||
|
||||
$Block['element']['element']['text'] .= $Context->line()->ltrimBodyUpto(4);
|
||||
|
||||
return $Block;
|
||||
}
|
||||
}
|
||||
|
||||
protected function blockCodeComplete($Block)
|
||||
{
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
# Reference
|
||||
|
||||
|
Reference in New Issue
Block a user