mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Allow multi-line emphasis. Fix #28.
This commit is contained in:
parent
df3db71698
commit
1f347e17eb
@ -678,14 +678,14 @@ class Parsedown
|
|||||||
|
|
||||||
if (strpos($text, '_') !== FALSE)
|
if (strpos($text, '_') !== FALSE)
|
||||||
{
|
{
|
||||||
$text = preg_replace('/__(?=\S)(.+?)(?<=\S)__/', '<strong>$1</strong>', $text);
|
$text = preg_replace('/__(?=\S)(.+?)(?<=\S)__/s', '<strong>$1</strong>', $text);
|
||||||
$text = preg_replace('/_(?=\S)(.+?)(?<=\S)_/', '<em>$1</em>', $text);
|
$text = preg_replace('/_(?=\S)(.+?)(?<=\S)_/s', '<em>$1</em>', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($text, '*') !== FALSE)
|
if (strpos($text, '*') !== FALSE)
|
||||||
{
|
{
|
||||||
$text = preg_replace('/\*\*(?=\S)(.+?)(?<=\S)\*\*/', '<strong>$1</strong>', $text);
|
$text = preg_replace('/\*\*(?=\S)(.+?)(?<=\S)\*\*/s', '<strong>$1</strong>', $text);
|
||||||
$text = preg_replace('/\*(?=\S)(.+?)(?<=\S)\*/', '<em>$1</em>', $text);
|
$text = preg_replace('/\*(?=\S)(.+?)(?<=\S)\*/s', '<em>$1</em>', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = strtr($text, $map);
|
$text = strtr($text, $map);
|
||||||
|
@ -4,4 +4,8 @@
|
|||||||
<p>Here's <em>one that uses underscores</em>. </p>
|
<p>Here's <em>one that uses underscores</em>. </p>
|
||||||
<p>Here's <strong>a strong one that uses underscores</strong>.</p>
|
<p>Here's <strong>a strong one that uses underscores</strong>.</p>
|
||||||
<p>This is not _ one _ neither is * this * neither is _ this_ neither is _this _.</p>
|
<p>This is not _ one _ neither is * this * neither is _ this_ neither is _this _.</p>
|
||||||
<p>An empty emphasis ** is not __ an emphasis.</p>
|
<p>An empty emphasis ** is not __ an emphasis.</p>
|
||||||
|
<p>A <em>multi-line
|
||||||
|
emphasis</em></p>
|
||||||
|
<p>A <strong>multi-line
|
||||||
|
strong emphasis</strong></p>
|
@ -10,4 +10,10 @@ Here's __a strong one that uses underscores__.
|
|||||||
|
|
||||||
This is not _ one _ neither is * this * neither is _ this_ neither is _this _.
|
This is not _ one _ neither is * this * neither is _ this_ neither is _this _.
|
||||||
|
|
||||||
An empty emphasis ** is not __ an emphasis.
|
An empty emphasis ** is not __ an emphasis.
|
||||||
|
|
||||||
|
A *multi-line
|
||||||
|
emphasis*
|
||||||
|
|
||||||
|
A **multi-line
|
||||||
|
strong emphasis**
|
Loading…
x
Reference in New Issue
Block a user