. */ class GfmEmphasisUnderscore extends AbstractFormatting { /** @inheritdoc */ public function getSort() { return 80; } /** @inheritdoc */ protected function getModeName(): string { return 'gfm_emphasis_underscore'; } /** @inheritdoc */ protected function getInstructionName(): string { return 'emphasis'; } /** @inheritdoc */ protected function getEntryPattern(): string { // Entry requires a valid closing `_` (non-whitespace char before it AND // NO_WORD_AFTER following). Otherwise emphasis would open with no way // to ever close (or close at an invalid position). return self::NO_WORD_BEFORE . '_(?=[^\s_])' . '(?=' . self::CONTENT_UNTIL_PARA . '[^\s]_' . self::NO_WORD_AFTER . ')'; } /** @inheritdoc */ protected function getExitPattern(): string { return '(?<=[^\s])_' . self::NO_WORD_AFTER; } }