mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
7bb70186c1 | |||
3225c66863 | |||
d6dc5ba25b |
@ -779,14 +779,19 @@ class Parsedown
|
|||||||
|
|
||||||
if (strpos($text, '_') !== FALSE)
|
if (strpos($text, '_') !== FALSE)
|
||||||
{
|
{
|
||||||
$text = preg_replace('/__(?=\S)(.+?)(?<=\S)__(?!_)/s', '<strong>$1</strong>', $text);
|
$text = preg_replace('/__(?=\S)([^_]+?)(?<=\S)__/s', '<strong>$1</strong>', $text, -1, $count);
|
||||||
|
$count or $text = preg_replace('/__(?=\S)(.+?)(?<=\S)__(?!_)/s', '<strong>$1</strong>', $text);
|
||||||
|
|
||||||
$text = preg_replace('/\b_(?=\S)(.+?)(?<=\S)_\b/s', '<em>$1</em>', $text);
|
$text = preg_replace('/\b_(?=\S)(.+?)(?<=\S)_\b/s', '<em>$1</em>', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($text, '*') !== FALSE)
|
if (strpos($text, '*') !== FALSE)
|
||||||
{
|
{
|
||||||
$text = preg_replace('/\*\*(?=\S)(.+?)(?<=\S)\*\*(?!\*)/s', '<strong>$1</strong>', $text);
|
$text = preg_replace('/\*\*(?=\S)([^*]+?)(?<=\S)\*\*/s', '<strong>$1</strong>', $text, -1, $count);
|
||||||
$text = preg_replace('/\*(?=\S)(.+?)(?<=\S)\*/s', '<em>$1</em>', $text);
|
$count or $text = preg_replace('/\*\*(?=\S)(.+?)(?<=\S)\*\*(?!\*)/s', '<strong>$1</strong>', $text);
|
||||||
|
|
||||||
|
$text = preg_replace('/\*(?=\S)([^*]+?)(?<=\S)\*/s', '<em>$1</em>', $text, -1, $count);
|
||||||
|
$count or $text = preg_replace('/\*(?=\S)(.+?)(?<=\S)\*(?!\*)/s', '<em>$1</em>', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = strtr($text, $map);
|
$text = strtr($text, $map);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
## Parsedown
|
## Parsedown
|
||||||
|
|
||||||
Fast, consistent and easy to use [Markdown][1] parser for PHP.
|
Fast and consistent [Markdown][1] parser for PHP.
|
||||||
|
|
||||||
[Home](http://parsedown.org) · [Demo](http://parsedown.org/explorer/) · [Tests](http://parsedown.org/tests/)
|
[Home](http://parsedown.org) · [Demo](http://parsedown.org/explorer/) · [Tests](http://parsedown.org/tests/)
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<p><strong><em>em strong</em></strong></p>
|
<p><strong><em>em strong</em> strong</strong></p>
|
||||||
<p><strong><em>one</em> at the start</strong></p>
|
<p><strong>strong <em>em strong</em></strong></p>
|
||||||
<p><strong>one at the <em>end</em></strong></p>
|
<p><strong>strong <em>em strong</em> strong</strong></p>
|
||||||
<p><strong>one <em>in the</em> middle</strong></p>
|
<p><strong>strong <em>em strong</em></strong></p>
|
||||||
<p><strong>one with <em>asterisks</em></strong></p>
|
|
@ -1,9 +1,7 @@
|
|||||||
___em strong___
|
___em strong_ strong__
|
||||||
|
|
||||||
___one_ at the start__
|
__strong _em strong___
|
||||||
|
|
||||||
__one at the _end___
|
__strong _em strong_ strong__
|
||||||
|
|
||||||
__one _in the_ middle__
|
**strong *em strong***
|
||||||
|
|
||||||
**one with *asterisks***
|
|
6
tests/data/strong_em.html
Normal file
6
tests/data/strong_em.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<p><em><strong>strong em</strong></em> </p>
|
||||||
|
<p><em>em <strong>strong em</strong></em></p>
|
||||||
|
<p><em><strong>strong em</strong> em</em></p>
|
||||||
|
<p><em><strong>strong em</strong></em></p>
|
||||||
|
<p><em>em <strong>strong em</strong></em></p>
|
||||||
|
<p><em><strong>strong em</strong> em</em></p>
|
11
tests/data/strong_em.md
Normal file
11
tests/data/strong_em.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
***strong em***
|
||||||
|
|
||||||
|
*em **strong em***
|
||||||
|
|
||||||
|
***strong em** em*
|
||||||
|
|
||||||
|
___strong em___
|
||||||
|
|
||||||
|
_em __strong em___
|
||||||
|
|
||||||
|
___strong em__ em_
|
Reference in New Issue
Block a user