text = $text; $this->width = $width; } /** * @param Excerpt $Excerpt * @param State $State * @return static|null */ public static function build(Excerpt $Excerpt, State $State) { $marker = $Excerpt->text()[0]; if ($marker !== '`') { return null; } if (\preg_match( '/^(['.$marker.']++)[ ]*+(.+?)[ ]*+(?text(), $matches )) { $text = \preg_replace('/[ ]*+\n/', ' ', $matches[2]); return new self($text, \strlen($matches[0])); } } /** * @return Element */ public function stateRenderable(Parsedown $_) { return new Element('code', [], [new Text($this->text)]); } /** * @return Text */ public function bestPlaintext() { return new Text($this->text); } }