|
@@ -2342,14 +2342,14 @@ showdown.subParser('italicsAndBold', function (text, options, globals) {
|
|
|
|
|
|
// Now parse asterisks
|
|
|
if (options.literalMidWordAsterisks) {
|
|
|
- text = text.trim().replace(/(?:^| +)\*{3}(\S[\s\S]*?)\*{3}(?: +|$)/g, function (wm, txt) {
|
|
|
- return parseInside (txt, ' <strong><em>', '</em></strong> ');
|
|
|
+ text = text.trim().replace(/(^| )\*{3}(\S[\s\S]*?)\*{3}([ ,;!?.]|$)/g, function (wm, lead, txt, trail) {
|
|
|
+ return parseInside (txt, lead + '<strong><em>', '</em></strong>' + trail);
|
|
|
});
|
|
|
- text = text.trim().replace(/(?:^| +)\*{2}(\S[\s\S]*?)\*{2}(?: +|$)/g, function (wm, txt) {
|
|
|
- return parseInside (txt, ' <strong>', '</strong> ');
|
|
|
+ text = text.trim().replace(/(^| )\*{2}(\S[\s\S]*?)\*{2}([ ,;!?.]|$)/g, function (wm, lead, txt, trail) {
|
|
|
+ return parseInside (txt, lead + '<strong>', '</strong>' + trail);
|
|
|
});
|
|
|
- text = text.trim().replace(/(?:^| +)\*{1}(\S[\s\S]*?)\*{1}(?: +|$)/g, function (wm, txt) {
|
|
|
- return parseInside (txt, ' <em>', '</em>' + (wm.slice(-1) === ' ' ? ' ' : ''));
|
|
|
+ text = text.trim().replace(/(^| )\*(\S[\s\S]*?)\*([ ,;!?.]|$)/g, function (wm, lead, txt, trail) {
|
|
|
+ return parseInside (txt, lead + '<em>', '</em>' + trail);
|
|
|
});
|
|
|
} else {
|
|
|
text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
|