1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5/** 6 * GFM strikethrough via paired double tildes: `~~text~~`. 7 * 8 * Emits deleted_open / deleted_close — the same instructions as DokuWiki's 9 * Deleted (`<del>…</del>`), so both syntaxes render as <del>. 10 */ 11class GfmDeleted extends AbstractFormatting 12{ 13 /** @inheritdoc */ 14 public function getSort() 15 { 16 return 130; 17 } 18 19 /** @inheritdoc */ 20 protected function getModeName(): string 21 { 22 return 'gfm_deleted'; 23 } 24 25 /** @inheritdoc */ 26 protected function getInstructionName(): string 27 { 28 return 'deleted'; 29 } 30 31 /** @inheritdoc */ 32 protected function getEntryPattern(): string 33 { 34 // Broken down: 35 // (?<!~) — not preceded by `~` (runs of 3+ tildes 36 // are fenced-code markers, not strike) 37 // ~~ — two opening tildes 38 // (?=[^\s~]) — next body char: not whitespace, not `~` 39 return '(?<!~)~~(?=[^\s~])'; 40 } 41 42 /** @inheritdoc */ 43 protected function getExitPattern(): string 44 { 45 return '(?<=[^\s])~~(?!~)'; 46 } 47} 48