Skip to content

Commit fe70e45

Browse files
committed
fix(literalMidWordAsterisks): now parses single characters enclosed by * correctly
Closes #478
1 parent a8bcde1 commit fe70e45

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

dist/showdown.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/subParsers/italicsAndBold.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ showdown.subParser('italicsAndBold', function (text, options, globals) {
4242

4343
// Now parse asterisks
4444
if (options.literalMidWordAsterisks) {
45-
text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]+?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
45+
text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
4646
return parseInside (txt, lead + '<strong><em>', '</em></strong>');
4747
});
48-
text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]+?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
48+
text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
4949
return parseInside (txt, lead + '<strong>', '</strong>');
5050
});
51-
text = text.replace(/([^*]|^)\B\*(\S[\s\S]+?)\*\B(?!\*)/g, function (wm, lead, txt) {
51+
text = text.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (wm, lead, txt) {
5252
return parseInside (txt, lead + '<em>', '</em>');
5353
});
5454
} else {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<p>Click the <strong>X</strong></p>
2+
<p>Click the <strong>X</strong> button and then the <strong>OK</strong> button</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Click the **X**
2+
3+
Click the **X** button and then the **OK** button

0 commit comments

Comments
 (0)