1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5/** 6 * GFM / CommonMark em-wrapping-strong via triple underscores: `___text___`. 7 * 8 * Only loaded when Markdown is the only or preferred syntax. Renders as 9 * <em><strong>text</strong></em>. Only the exact 3+3 symmetric variant is 10 * supported; longer and asymmetric runs require CommonMark's full 11 * delimiter-pairing algorithm and are out of scope. 12 * 13 * Inherits `handle()` and `getSort()` from GfmEmphasisStrong since the 14 * emitted instructions and sort priority are identical; only the delimiter 15 * patterns and word-boundary rules differ. 16 */ 17class GfmEmphasisStrongUnderscore extends GfmEmphasisStrong 18{ 19 /** @inheritdoc */ 20 protected function getModeName(): string 21 { 22 return 'gfm_emphasis_strong_underscore'; 23 } 24 25 /** @inheritdoc */ 26 protected function getEntryPattern(): string 27 { 28 // NO_WORD_BEFORE + `(?<!_)` blocks intraword and longer-run openers. 29 // `(?=[^\s_])` enforces the flanking-opener rule. 30 return self::NO_WORD_BEFORE 31 . '(?<!_)___(?=[^\s_])'; 32 } 33 34 /** @inheritdoc */ 35 protected function getExitPattern(): string 36 { 37 return '(?<=[^\s])___(?!_)' . self::NO_WORD_AFTER; 38 } 39} 40