Skip to content
This repository was archived by the owner on Aug 6, 2020. It is now read-only.

Support for strikethrough, same as GFM #10

Merged
merged 1 commit into from
Jun 29, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion markdown_extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function MarkdownExtraExtended_Parser($default_classes = array()) {
$this->block_gamut += array(
"doFencedFigures" => 7,
);

$this->span_gamut += array(
"doStrikethroughs" => -35
);
parent::MarkdownExtra_Parser();
}

Expand Down Expand Up @@ -157,5 +159,19 @@ function _doFencedFigures_callback($matches) {
$res .= "</figure>";
return "\n". $this->hashBlock($res)."\n\n";
}
function doStrikethroughs($text) {
#
# Replace ~~some deleted text~~ with <del>some deleted text</del>
#
$text = preg_replace_callback('{
~~([^~]+)~~
}xm',
array(&$this, '_doStrikethroughs_callback'), $text);
return $text;
}
function _doStrikethroughs_callback($matches) {
$res = "<del>" . $matches[1] . "</del>";
return $this->hashBlock($res);
}
}
?>