Skip to content

Commit

Permalink
EmphStrongTrait: improved Unicode space check
Browse files Browse the repository at this point in the history
  • Loading branch information
xenocrat committed Oct 15, 2024
1 parent 1bd10ab commit 8390562
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/inline/EmphStrongTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ protected function parseEmphStrong($markdown): array
// First and last chars of the strong text
// cannot be whitespace.
if (
strspn($content, " \t\n", 0, 1) === 0
&& strspn($content, " \t\n", -1) === 0
preg_match(
'/^(?![\s\p{Zs}]).+(?<![\s\p{Zs}])$/us',
$content
)
) {
return [
[
Expand Down Expand Up @@ -101,8 +103,10 @@ protected function parseEmphStrong($markdown): array
// First and last chars of the emphasised text
// cannot be whitespace.
if (
strspn($content, " \t\n", 0, 1) === 0
&& strspn($content, " \t\n", -1) === 0
preg_match(
'/^(?![\s\p{Zs}]).+(?<![\s\p{Zs}])$/us',
$content
)
) {
return [
[
Expand Down

0 comments on commit 8390562

Please sign in to comment.