Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CentralNic
parsedown
Commits
3225c668
Commit
3225c668
authored
Nov 23, 2013
by
Emanuil Rusev
Browse files
***strong em** inside of em* should produce valid markup
parent
d6dc5ba2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Parsedown.php
View file @
3225c668
...
...
@@ -779,14 +779,19 @@ class Parsedown
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
);
}
if
(
strpos
(
$text
,
'*'
)
!==
FALSE
)
{
$text
=
preg_replace
(
'/\*\*(?=\S)(.+?)(?<=\S)\*\*(?!\*)/s'
,
'<strong>$1</strong>'
,
$text
);
$text
=
preg_replace
(
'/\*(?=\S)(.+?)(?<=\S)\*/s'
,
'<em>$1</em>'
,
$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
(
'/\*(?=\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
);
...
...
tests/data/strong_em.html
0 → 100644
View file @
3225c668
<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>
\ No newline at end of file
tests/data/strong_em.md
0 → 100644
View file @
3225c668
***strong em**
*
*em **strong em***
***strong em**
em
*
___strong em__
_
_em __strong em___
___strong em__
em_
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment