|
@@ -1,4 +1,4 @@
|
|
|
-;/*! showdown v 2.0.0-alpha1 - 14-09-2018 */
|
|
|
+;/*! showdown v 2.0.0-alpha1 - 15-09-2018 */
|
|
|
(function(){
|
|
|
/**
|
|
|
* Created by Tivie on 13-07-2015.
|
|
@@ -2793,7 +2793,7 @@ showdown.subParser('makehtml.encodeBackslashEscapes', function (text, options, g
|
|
|
text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.before', text, options, globals).getText();
|
|
|
|
|
|
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
|
|
|
- text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
|
|
|
+ text = text.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, showdown.helper.escapeCharactersCallback);
|
|
|
|
|
|
text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.after', text, options, globals).getText();
|
|
|
return text;
|
|
@@ -2872,7 +2872,7 @@ showdown.subParser('makehtml.githubCodeBlocks', function (text, options, globals
|
|
|
|
|
|
text += '¨0';
|
|
|
|
|
|
- text = text.replace(/(?:^|\n)(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n\1/g, function (wholeMatch, delim, language, codeblock) {
|
|
|
+ text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
|
|
|
var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
|
|
|
|
|
|
// First parse the github code block
|
|
@@ -3387,11 +3387,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;
|
|
|
}
|
|
|
|
|
@@ -3420,6 +3415,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>');
|
|
@@ -3431,18 +3427,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;
|
|
@@ -3496,6 +3492,7 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
|
|
|
// Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
|
|
|
// which is a syntax breaking change
|
|
|
// activating this option reverts to old behavior
|
|
|
+ // This will be removed in version 2.0
|
|
|
if (options.disableForced4SpacesIndentedSublists) {
|
|
|
rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
|
|
|
}
|
|
@@ -3531,13 +3528,25 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
|
|
|
return '¨A' + wm2;
|
|
|
});
|
|
|
|
|
|
+ // SPECIAL CASE: an heading followed by a paragraph of text that is not separated by a double newline
|
|
|
+ // or/nor indented. ex:
|
|
|
+ //
|
|
|
+ // - # foo
|
|
|
+ // bar is great
|
|
|
+ //
|
|
|
+ // While this does now follow the spec per se, not allowing for this might cause confusion since
|
|
|
+ // header blocks don't need double newlines after
|
|
|
+ if (/^#+.+\n.+/.test(item)) {
|
|
|
+ item = item.replace(/^(#+.+)$/m, '$1\n');
|
|
|
+ }
|
|
|
+
|
|
|
// m1 - Leading line or
|
|
|
- // Has a double return (multi paragraph) or
|
|
|
- // Has sublist
|
|
|
+ // Has a double return (multi paragraph)
|
|
|
if (m1 || (item.search(/\n{2,}/) > -1)) {
|
|
|
item = showdown.subParser('makehtml.githubCodeBlocks')(item, options, globals);
|
|
|
item = showdown.subParser('makehtml.blockGamut')(item, options, globals);
|
|
|
} else {
|
|
|
+
|
|
|
// Recursion for sub-lists:
|
|
|
item = showdown.subParser('makehtml.lists')(item, options, globals);
|
|
|
item = item.replace(/\n$/, ''); // chomp(item)
|
|
@@ -3545,6 +3554,7 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
|
|
|
|
|
|
// Colapse double linebreaks
|
|
|
item = item.replace(/\n\n+/g, '\n\n');
|
|
|
+
|
|
|
if (isParagraphed) {
|
|
|
item = showdown.subParser('makehtml.paragraphs')(item, options, globals);
|
|
|
} else {
|
|
@@ -3624,26 +3634,25 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- /** Start of list parsing **/
|
|
|
+ // Start of list parsing
|
|
|
+ var subListRgx = /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
|
|
|
+ var mainListRgx = /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
|
|
|
+
|
|
|
text = globals.converter._dispatch('lists.before', text, options, globals).getText();
|
|
|
// add sentinel to hack around khtml/safari bug:
|
|
|
// http://bugs.webkit.org/show_bug.cgi?id=11231
|
|
|
text += '¨0';
|
|
|
|
|
|
if (globals.gListLevel) {
|
|
|
- text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
|
|
|
- function (wholeMatch, list, m2) {
|
|
|
- var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
|
|
|
- return parseConsecutiveLists(list, listType, true);
|
|
|
- }
|
|
|
- );
|
|
|
+ text = text.replace(subListRgx, function (wholeMatch, list, m2) {
|
|
|
+ var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
|
|
|
+ return parseConsecutiveLists(list, listType, true);
|
|
|
+ });
|
|
|
} else {
|
|
|
- text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
|
|
|
- function (wholeMatch, m1, list, m3) {
|
|
|
- var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
|
|
|
- return parseConsecutiveLists(list, listType, false);
|
|
|
- }
|
|
|
- );
|
|
|
+ text = text.replace(mainListRgx, function (wholeMatch, m1, list, m3) {
|
|
|
+ var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
|
|
|
+ return parseConsecutiveLists(list, listType, false);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// strip sentinel
|