1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5/** 6 * GFM / CommonMark strong emphasis via double underscores: `__text__`. 7 * 8 * Only loaded when Markdown is the only or preferred syntax 9 * 10 * Emits strong_open / strong_close — the same instructions as DokuWiki's 11 * Strong (`**`), so both delimiters render as <strong>. 12 */ 13class GfmStrongUnderscore extends AbstractFormatting 14{ 15 /** @inheritdoc */ 16 public function getSort() 17 { 18 return 70; 19 } 20 21 /** @inheritdoc */ 22 protected function getModeName(): string 23 { 24 return 'gfm_strong_underscore'; 25 } 26 27 /** @inheritdoc */ 28 protected function getInstructionName(): string 29 { 30 return 'strong'; 31 } 32 33 /** @inheritdoc */ 34 protected function getEntryPattern(): string 35 { 36 return self::NO_WORD_BEFORE 37 . '__(?=[^\s_])' 38 . '(?=' . self::CONTENT_UNTIL_PARA . '[^\s]__' . self::NO_WORD_AFTER . ')'; 39 } 40 41 /** @inheritdoc */ 42 protected function getExitPattern(): string 43 { 44 return '(?<=[^\s])__' . self::NO_WORD_AFTER; 45 } 46} 47