`\s]+|"[^"]*+"|\'[^\']*+\'))?+'; /** @var string */ private $html; /** * @param string $html */ public function __construct($html) { $this->html = $html; } /** * @param Context $Context * @param Block|null $Block * @param State|null $State * @return static|null */ public static function build( Context $Context, Block $Block = null, State $State = null ) { if (\preg_match('/^<[\/]?+(\w*)(?:[ ]*+'.self::REGEX_HTML_ATTRIBUTE.')*+[ ]*+(\/)?>/', $Context->line()->text(), $matches)) { $element = \strtolower($matches[1]); if (\array_key_exists($element, Element::$TEXT_LEVEL_ELEMENTS)) { return null; } return new self($Context->line()->text()); } } /** * @param Context $Context * @return self|null */ public function advance(Context $Context) { if ($this->interrupted) { return null; } $html = $this->html . "\n" . $Context->line()->rawLine(); return new self($html); } /** * @return Handler */ public function stateRenderable(Parsedown $Parsedown) { return new Handler( /** @return Element|RawHtml */ function (State $State) { $SafeMode = $State->getOrDefault(SafeMode::class); if ($SafeMode->enabled()) { return new Element('p', [], [new Text($this->html)]); } else { return new RawHtml($this->html); } } ); } }