diff --git a/src/CustomMarkdown.php b/src/CustomMarkdown.php index 06100def..2e4df205 100644 --- a/src/CustomMarkdown.php +++ b/src/CustomMarkdown.php @@ -5,7 +5,8 @@ class CustomMarkdown extends \Michelf\Markdown { $this->no_markup = true; $this->span_gamut += ['doSpoilers' => 71]; - $this->span_gamut += ['doUsers' => 7]; + $this->span_gamut += ['doSpoilers' => 71]; + $this->span_gamut += ['doStrike' => 6]; $this->span_gamut += ['doPosts' => 8]; $this->span_gamut += ['doTags' => 9]; $this->span_gamut += ['doAutoLinks2' => 29]; @@ -45,6 +46,14 @@ class CustomMarkdown extends \Michelf\Markdown return preg_replace_callback('/\n/', [&$this, '_doHardBreaks_callback'], $text); } + protected function doStrike($text) + { + return preg_replace_callback('{(~~|---)([^~]+)\1}', function($x) + { + return $this->hashPart('') . $x[2] . $this->hashPart(''); + }, $text); + } + protected function doSpoilers($text) { if (is_array($text))