diff --git a/Parsedown.php b/Parsedown.php index 2cbf3f2..81bbab3 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1410,13 +1410,13 @@ class Parsedown ); protected $StrongRegex = array( - '*' => '/^[*]{2}((?:[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', - '_' => '/^__((?:[^_]|_[^_]*_)+?)__(?!_)/us', + '*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', + '_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us', ); protected $EmRegex = array( - '*' => '/^[*]((?:[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', - '_' => '/^_((?:[^_]|__[^_]*__)+?)_(?!_)\b/us', + '*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', + '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us', ); protected $voidElements = array( diff --git a/test/data/escaping.html b/test/data/escaping.html index 64676cb..ab1c41f 100644 --- a/test/data/escaping.html +++ b/test/data/escaping.html @@ -1,4 +1,6 @@
escaped *emphasis*.
escaped \*emphasis\* in a code span
escaped \*emphasis\* in a code block
-\ ` * _ { } [ ] ( ) > # + - . !
\ No newline at end of file +\ ` * _ { } [ ] ( ) > # + - . !
+one_two one_two
+one*two one*two
\ No newline at end of file diff --git a/test/data/escaping.md b/test/data/escaping.md index 164039f..9f174e9 100644 --- a/test/data/escaping.md +++ b/test/data/escaping.md @@ -4,4 +4,8 @@ escaped \*emphasis\*. escaped \*emphasis\* in a code block -\\ \` \* \_ \{ \} \[ \] \( \) \> \# \+ \- \. \! \ No newline at end of file +\\ \` \* \_ \{ \} \[ \] \( \) \> \# \+ \- \. \! + +_one\_two_ __one\_two__ + +*one\*two* **one\*two** \ No newline at end of file