Skip to content

Commit

Permalink
fix(literalMidWordAsterisks): now parses single characters enclosed b…
Browse files Browse the repository at this point in the history
…y * correctly

Closes #478
  • Loading branch information
tivie committed Dec 22, 2017
1 parent a8bcde1 commit fe70e45
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/subParsers/italicsAndBold.js
Expand Up @@ -42,13 +42,13 @@ showdown.subParser('italicsAndBold', function (text, options, globals) {

// Now parse asterisks
if (options.literalMidWordAsterisks) {
text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]+?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
return parseInside (txt, lead + '<strong><em>', '</em></strong>');
});
text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]+?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
return parseInside (txt, lead + '<strong>', '</strong>');
});
text = text.replace(/([^*]|^)\B\*(\S[\s\S]+?)\*\B(?!\*)/g, function (wm, lead, txt) {
text = text.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (wm, lead, txt) {
return parseInside (txt, lead + '<em>', '</em>');
});
} else {
Expand Down
@@ -0,0 +1,2 @@
<p>Click the <strong>X</strong></p>
<p>Click the <strong>X</strong> button and then the <strong>OK</strong> button</p>
@@ -0,0 +1,3 @@
Click the **X**

Click the **X** button and then the **OK** button

0 comments on commit fe70e45

Please sign in to comment.