mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
implement GFM strikethrough
This commit is contained in:
parent
b6f795962f
commit
5a563008aa
@ -766,6 +766,11 @@ class Parsedown
|
||||
|
||||
# ~
|
||||
|
||||
if (strpos($text, '~~') !== FALSE)
|
||||
{
|
||||
$text = preg_replace('/~~(?=\S)(.+?)(?<=\S)~~/s', '<del>$1</del>', $text);
|
||||
}
|
||||
|
||||
if (strpos($text, '_') !== FALSE)
|
||||
{
|
||||
$text = preg_replace('/__(?=\S)(.+?)(?<=\S)__(?!_)/s', '<strong>$1</strong>', $text);
|
||||
|
3
tests/data/strikethrough.html
Normal file
3
tests/data/strikethrough.html
Normal file
@ -0,0 +1,3 @@
|
||||
<p><del>strikethrough</del></p>
|
||||
<p>in the <del>middle</del> of a sentence</p>
|
||||
<p>in the middle of a w<del>or</del>d</p>
|
5
tests/data/strikethrough.md
Normal file
5
tests/data/strikethrough.md
Normal file
@ -0,0 +1,5 @@
|
||||
~~strikethrough~~
|
||||
|
||||
in the ~~middle~~ of a sentence
|
||||
|
||||
in the middle of a w~~or~~d
|
Loading…
Reference in New Issue
Block a user