text = $text; $this->width = $width; } /** * @param Excerpt $Excerpt * @param State $State * @return static|null */ public static function build(Excerpt $Excerpt, State $State) { $text = $Excerpt->text(); if (\strlen($text) < 2) { return null; } if ($text[1] === '~' and \preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $text, $matches)) { return new self($matches[1], \strlen($matches[0])); } return null; } /** * @return Handler */ public function stateRenderable(Parsedown $Parsedown) { return new Handler( /** @return Element */ function (State $State) use ($Parsedown) { return new Element( 'del', [], $State->applyTo($Parsedown->line($this->text)) ); } ); } /** * @return Text */ public function bestPlaintext() { return new Text($this->text); } }