From fe7ba8e0d47f35c9914391728d576d546669c0a2 Mon Sep 17 00:00:00 2001 From: liudng Date: Sat, 20 Dec 2014 17:40:19 +0800 Subject: [PATCH] Embedded in italics must add a space in front of the first asterisk and add a space after the second asterisk. --- src/showdown.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/showdown.js b/src/showdown.js index b488bad..c0a531a 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -1133,7 +1133,10 @@ var _DoItalicsAndBold = function(text) { text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, "$2"); - text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, + text = text.replace(/^(\*|_)(?=\S)([^\r]*?\S)\1/g, + "$2"); + + text = text.replace(/ (\*|_)(?=\S)([^\r]*?\S)\1 /g, "$2"); return text;