|
@@ -1,4 +1,4 @@
|
|
-;/*! showdown 31-03-2017 */
|
|
|
|
|
|
+;/*! showdown 23-04-2017 */
|
|
(function(){
|
|
(function(){
|
|
/**
|
|
/**
|
|
* Created by Tivie on 13-07-2015.
|
|
* Created by Tivie on 13-07-2015.
|
|
@@ -53,6 +53,11 @@ function getDefaultOpts (simple) {
|
|
describe: 'Parse midword underscores as literal underscores',
|
|
describe: 'Parse midword underscores as literal underscores',
|
|
type: 'boolean'
|
|
type: 'boolean'
|
|
},
|
|
},
|
|
|
|
+ literalMidWordAsterisks: {
|
|
|
|
+ defaultValue: false,
|
|
|
|
+ describe: 'Parse midword asterisks as literal asterisks',
|
|
|
|
+ type: 'boolean'
|
|
|
|
+ },
|
|
strikethrough: {
|
|
strikethrough: {
|
|
defaultValue: false,
|
|
defaultValue: false,
|
|
describe: 'Turn on/off strikethrough support',
|
|
describe: 'Turn on/off strikethrough support',
|
|
@@ -2240,16 +2245,29 @@ showdown.subParser('italicsAndBold', function (text, options, globals) {
|
|
}
|
|
}
|
|
|
|
|
|
// Now parse asterisks
|
|
// Now parse asterisks
|
|
- 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;
|
|
|
|
- });
|
|
|
|
|
|
+ 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(/(?:^| +)\*{2}(\S[\s\S]*?)\*{2}(?: +|$)/g, function (wm, txt) {
|
|
|
|
+ return parseInside (txt, ' <strong>', '</strong> ');
|
|
|
|
+ });
|
|
|
|
+ text = text.trim().replace(/(?:^| +)\*{1}(\S[\s\S]*?)\*{1}(?: +|$)/g, function (wm, txt) {
|
|
|
|
+ return parseInside (txt, ' <em>', '</em>' + (wm.slice(-1) === ' ' ? ' ' : ''));
|
|
|
|
+ });
|
|
|
|
+ } 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 = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
|
|
text = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
|
|
return text;
|
|
return text;
|