Added strike through support to Markdown
This commit is contained in:
parent
52ceb8d962
commit
7605177a6b
1 changed files with 10 additions and 1 deletions
|
@ -5,7 +5,8 @@ class CustomMarkdown extends \Michelf\Markdown
|
||||||
{
|
{
|
||||||
$this->no_markup = true;
|
$this->no_markup = true;
|
||||||
$this->span_gamut += ['doSpoilers' => 71];
|
$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 += ['doPosts' => 8];
|
||||||
$this->span_gamut += ['doTags' => 9];
|
$this->span_gamut += ['doTags' => 9];
|
||||||
$this->span_gamut += ['doAutoLinks2' => 29];
|
$this->span_gamut += ['doAutoLinks2' => 29];
|
||||||
|
@ -45,6 +46,14 @@ class CustomMarkdown extends \Michelf\Markdown
|
||||||
return preg_replace_callback('/\n/', [&$this, '_doHardBreaks_callback'], $text);
|
return preg_replace_callback('/\n/', [&$this, '_doHardBreaks_callback'], $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function doStrike($text)
|
||||||
|
{
|
||||||
|
return preg_replace_callback('{(~~|---)([^~]+)\1}', function($x)
|
||||||
|
{
|
||||||
|
return $this->hashPart('<del>') . $x[2] . $this->hashPart('</del>');
|
||||||
|
}, $text);
|
||||||
|
}
|
||||||
|
|
||||||
protected function doSpoilers($text)
|
protected function doSpoilers($text)
|
||||||
{
|
{
|
||||||
if (is_array($text))
|
if (is_array($text))
|
||||||
|
|
Loading…
Reference in a new issue