2 && ltrim($math, ' ') !== '' && substr($math, 0, 1) === ' ' && substr($math, -1) === ' ' ) { $math = substr($math, 1, -1); } return [ [ 'inlineMath', $math ], strlen($matches[0]) ]; } return [['text', $text[0] . $text[1]], 2]; } protected function renderInlineMath($block): string { return '' . $this->escapeHtmlEntities( $block[1], ENT_COMPAT | ENT_SUBSTITUTE ) . ''; } abstract protected function escapeHtmlEntities($text, $flags = 0); }