aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/inlinepatterns.py2
-rw-r--r--tests/misc/em_strong.html3
-rw-r--r--tests/misc/em_strong.txt1
3 files changed, 4 insertions, 2 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 6cec968..0267482 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -100,7 +100,7 @@ ESCAPE_RE = r'\\(.)' # \<
EMPHASIS_RE = r'(\*)([^\*]+)\2' # *emphasis*
STRONG_RE = r'(\*{2}|_{2})(.+?)\2' # **strong**
STRONG_EM_RE = r'(\*{3}|_{3})(.+?)\2' # ***strong***
-SMART_EMPHASIS_RE = r'(?<!\w)(_)(\S.+?)\2(?!\w)' # _smart_emphasis_
+SMART_EMPHASIS_RE = r'(?<!\w)(_)(?!_)(.+?)(?<!_)\2(?!\w)' # _smart_emphasis_
EMPHASIS_2_RE = r'(_)(.+?)\2' # _emphasis_
LINK_RE = NOIMG + BRK + \
r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)'''
diff --git a/tests/misc/em_strong.html b/tests/misc/em_strong.html
index 75c92d8..776381b 100644
--- a/tests/misc/em_strong.html
+++ b/tests/misc/em_strong.html
@@ -7,4 +7,5 @@
<p>three asterisks: ***</p>
<p>with spaces: * * *</p>
<p>three underscores: ___</p>
-<p>with spaces: _ _ _</p> \ No newline at end of file
+<p>with spaces: _ _ _</p>
+<p>One char: <em>a</em></p> \ No newline at end of file
diff --git a/tests/misc/em_strong.txt b/tests/misc/em_strong.txt
index d0774ad..1285665 100644
--- a/tests/misc/em_strong.txt
+++ b/tests/misc/em_strong.txt
@@ -18,3 +18,4 @@ three underscores: ___
with spaces: _ _ _
+One char: _a_