From b6f795962f82c4a0c4ae7616f929f9fc62aa1fa9 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Thu, 21 Nov 2013 00:59:12 +0200 Subject: [PATCH] resolve #21 --- Parsedown.php | 2 +- tests/data/emphasis.html | 1 + tests/data/emphasis.md | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Parsedown.php b/Parsedown.php index 45144bf..c84ae75 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -769,7 +769,7 @@ class Parsedown if (strpos($text, '_') !== FALSE) { $text = preg_replace('/__(?=\S)(.+?)(?<=\S)__(?!_)/s', '$1', $text); - $text = preg_replace('/_(?=\S)(.+?)(?<=\S)_/s', '$1', $text); + $text = preg_replace('/\b_(?=\S)(.+?)(?<=\S)_\b/s', '$1', $text); } if (strpos($text, '*') !== FALSE) diff --git a/tests/data/emphasis.html b/tests/data/emphasis.html index aac2810..ce129c9 100644 --- a/tests/data/emphasis.html +++ b/tests/data/emphasis.html @@ -2,4 +2,5 @@

multiline emphasis

_ this _ is not an emphasis, neither is _ this_, _this _, or _this*

+

this_is_not_an_emphasis

an empty emphasis __ ** is not an emphasis

\ No newline at end of file diff --git a/tests/data/emphasis.md b/tests/data/emphasis.md index d32cc56..dfbeea3 100644 --- a/tests/data/emphasis.md +++ b/tests/data/emphasis.md @@ -5,4 +5,6 @@ emphasis_ _ this _ is not an emphasis, neither is _ this_, _this _, or _this* +this_is_not_an_emphasis + an empty emphasis __ ** is not an emphasis \ No newline at end of file