mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
remove(literalMidWordAsterisks): remove literalMidWordAsterisks feature
This feature was seen as a bit "duh!" since midword asterisks are not really a thing and, for these situations, you can simply escape the asterisk character. Closes #499 BREAKING CHANGE: literalMidWordAsterisks option was removed and so asterisks will always retain their markdown magic meaning in a source text. If you're using this feature, and you wish to retain this option, you can find a shim here: <https://gist.github.com/tivie/7f8a88c89ffb00d2afe6c59a25528386>
This commit is contained in:
parent
a4be301331
commit
d9eea64794
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.
|
@ -8,11 +8,6 @@ showdown.subParser('makehtml.italicsAndBold', function (text, options, globals)
|
|||
// called "catastrophic backtrace". Ominous!
|
||||
|
||||
function parseInside (txt, left, right) {
|
||||
/*
|
||||
if (options.simplifiedAutoLink) {
|
||||
txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
|
||||
}
|
||||
*/
|
||||
return left + txt + right;
|
||||
}
|
||||
|
||||
|
@ -41,6 +36,7 @@ showdown.subParser('makehtml.italicsAndBold', function (text, options, globals)
|
|||
}
|
||||
|
||||
// Now parse asterisks
|
||||
/*
|
||||
if (options.literalMidWordAsterisks) {
|
||||
text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]+?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
|
||||
return parseInside (txt, lead + '<strong><em>', '</em></strong>');
|
||||
|
@ -52,18 +48,18 @@ showdown.subParser('makehtml.italicsAndBold', function (text, options, globals)
|
|||
return parseInside (txt, lead + '<em>', '</em>');
|
||||
});
|
||||
} else {
|
||||
text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
|
||||
});
|
||||
text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
|
||||
});
|
||||
text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
|
||||
// !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
|
||||
});
|
||||
}
|
||||
|
||||
*/
|
||||
text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
|
||||
});
|
||||
text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
|
||||
});
|
||||
text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
|
||||
// !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
|
||||
});
|
||||
//}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.italicsAndBold.after', text, options, globals).getText();
|
||||
return text;
|
||||
|
|
|
@ -14,7 +14,7 @@ var bootstrap = require('./makehtml.bootstrap.js'),
|
|||
emojisSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/emojis/'),
|
||||
underlineSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/underline/'),
|
||||
literalMidWordUnderscoresSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordUnderscores/'),
|
||||
literalMidWordAsterisksSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordAsterisks/'),
|
||||
//literalMidWordAsterisksSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordAsterisks/'),
|
||||
completeHTMLOutputSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/completeHTMLOutput/'),
|
||||
metadataSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/metadata/'),
|
||||
splitAdjacentBlockquotesSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/splitAdjacentBlockquotes/');
|
||||
|
@ -75,8 +75,6 @@ describe('makeHtml() features testsuite', function () {
|
|||
converter = new showdown.Converter({encodeEmails: false, simplifiedAutoLink: true});
|
||||
} else if (testsuite[i].name === '#331.allow-escaping-of-tilde') {
|
||||
converter = new showdown.Converter({strikethrough: true});
|
||||
} else if (testsuite[i].name === 'enable-literalMidWordAsterisks') {
|
||||
converter = new showdown.Converter({literalMidWordAsterisks: true});
|
||||
} else if (testsuite[i].name === 'prefixHeaderId-simple') {
|
||||
converter = new showdown.Converter({prefixHeaderId: true});
|
||||
} else if (testsuite[i].name === 'prefixHeaderId-string') {
|
||||
|
@ -95,8 +93,6 @@ describe('makeHtml() features testsuite', function () {
|
|||
converter = new showdown.Converter({backslashEscapesHTMLTags: true});
|
||||
} else if (testsuite[i].name === '#379.openLinksInNewWindow-breaks-em-markdup') {
|
||||
converter = new showdown.Converter({openLinksInNewWindow: true});
|
||||
} else if (testsuite[i].name === '#398.literalMidWordAsterisks-treats-non-word-characters-as-characters') {
|
||||
converter = new showdown.Converter({literalMidWordAsterisks: true});
|
||||
} else {
|
||||
converter = new showdown.Converter();
|
||||
}
|
||||
|
@ -226,6 +222,7 @@ describe('makeHtml() features testsuite', function () {
|
|||
});
|
||||
|
||||
/** test literalMidWordAsterisks option **/
|
||||
/*
|
||||
describe('literalMidWordAsterisks option', function () {
|
||||
var converter,
|
||||
suite = literalMidWordAsterisksSuite;
|
||||
|
@ -234,7 +231,7 @@ describe('makeHtml() features testsuite', function () {
|
|||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
|
||||
/** test completeHTMLDocument option **/
|
||||
describe('completeHTMLDocument option', function () {
|
||||
|
|
Loading…
Reference in New Issue
Block a user