mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(literalMidWordUnderscores): fix different behavior with asterisks
Closes #198
This commit is contained in:
parent
5b1f716151
commit
e86aea8183
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -7,8 +7,8 @@ showdown.subParser('italicsAndBold', function (text, options) {
|
|||
text = text.replace(/(^|\s|>|\b)__(?=\S)([^]+?)__(?=\b|<|\s|$)/gm, '$1<strong>$2</strong>');
|
||||
text = text.replace(/(^|\s|>|\b)_(?=\S)([^]+?)_(?=\b|<|\s|$)/gm, '$1<em>$2</em>');
|
||||
//asterisks
|
||||
text = text.replace(/\*\*(?=\S)([^]+?)\*\*/g, '<strong>$1</strong>');
|
||||
text = text.replace(/\*(?=\S)([^]+?)\*/g, '<em>$1</em>');
|
||||
text = text.replace(/(\*\*)(?=\S)([^\r]*?\S[*]*)\1/g, '<strong>$2</strong>');
|
||||
text = text.replace(/(\*)(?=\S)([^\r]*?\S)\1/g, '<em>$2</em>');
|
||||
|
||||
} else {
|
||||
// <strong> must go first:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<p>pointer *ptr *thing</p>
|
||||
|
||||
<p>something _else _bla</p>
|
||||
|
||||
<p>something __else __bla</p>
|
|
@ -0,0 +1,5 @@
|
|||
pointer *ptr *thing
|
||||
|
||||
something _else _bla
|
||||
|
||||
something __else __bla
|
|
@ -27,6 +27,8 @@ describe('makeHtml() features testsuite', function () {
|
|||
converter = new showdown.Converter({tasklists: true});
|
||||
} else if (testsuite[i].name === 'autolink-and-disallow-underscores') {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true, simplifiedAutoLink: true});
|
||||
} else if (testsuite[i].name === '#198.literalMidWordUnderscores-changes-behavior-of-asterisk') {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
||||
} else {
|
||||
converter = new showdown.Converter();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user