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

Add easy way to remove Components from InlineTyes and BlockTypes

This commit is contained in:
Aidan Woods
2019-01-25 20:54:25 +00:00
parent 9f9ef78662
commit 8fe93f30ac
5 changed files with 50 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ use Erusev\Parsedown\AST\Handler;
use Erusev\Parsedown\AST\StateRenderable;
use Erusev\Parsedown\Components\Inline;
use Erusev\Parsedown\Configurables\DefinitionBook;
use Erusev\Parsedown\Configurables\InlineTypes;
use Erusev\Parsedown\Configurables\SafeMode;
use Erusev\Parsedown\Html\Renderables\Element;
use Erusev\Parsedown\Html\Renderables\Text;
@@ -126,10 +127,14 @@ final class Link implements Inline
$attributes['href'] = Element::filterUnsafeUrl($attributes['href']);
}
$NewState = $State->setting(
$State->get(InlineTypes::class)->removing([Url::class])
);
return new Element(
'a',
$attributes,
$State->applyTo($Parsedown->line($this->label))
$State->applyTo((new Parsedown($NewState))->line($this->label))
);
}
);