Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: blocks.js
text = text.replace(/¨T/g, '¨');
[10000] Fix | Delete
[10001] Fix | Delete
// render a complete html document instead of a partial if the option is enabled
[10002] Fix | Delete
text = showdown.subParser('completeHTMLDocument')(text, options, globals);
[10003] Fix | Delete
[10004] Fix | Delete
// Run output modifiers
[10005] Fix | Delete
showdown.helper.forEach(outputModifiers, function (ext) {
[10006] Fix | Delete
text = showdown.subParser('runExtension')(ext, text, options, globals);
[10007] Fix | Delete
});
[10008] Fix | Delete
[10009] Fix | Delete
// update metadata
[10010] Fix | Delete
metadata = globals.metadata;
[10011] Fix | Delete
return text;
[10012] Fix | Delete
};
[10013] Fix | Delete
[10014] Fix | Delete
/**
[10015] Fix | Delete
* Converts an HTML string into a markdown string
[10016] Fix | Delete
* @param src
[10017] Fix | Delete
* @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
[10018] Fix | Delete
* @returns {string}
[10019] Fix | Delete
*/
[10020] Fix | Delete
this.makeMarkdown = this.makeMd = function (src, HTMLParser) {
[10021] Fix | Delete
[10022] Fix | Delete
// replace \r\n with \n
[10023] Fix | Delete
src = src.replace(/\r\n/g, '\n');
[10024] Fix | Delete
src = src.replace(/\r/g, '\n'); // old macs
[10025] Fix | Delete
[10026] Fix | Delete
// due to an edge case, we need to find this: > <
[10027] Fix | Delete
// to prevent removing of non silent white spaces
[10028] Fix | Delete
// ex: <em>this is</em> <strong>sparta</strong>
[10029] Fix | Delete
src = src.replace(/>[ \t]+</, '>¨NBSP;<');
[10030] Fix | Delete
[10031] Fix | Delete
if (!HTMLParser) {
[10032] Fix | Delete
if (window && window.document) {
[10033] Fix | Delete
HTMLParser = window.document;
[10034] Fix | Delete
} else {
[10035] Fix | Delete
throw new Error('HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM');
[10036] Fix | Delete
}
[10037] Fix | Delete
}
[10038] Fix | Delete
[10039] Fix | Delete
var doc = HTMLParser.createElement('div');
[10040] Fix | Delete
doc.innerHTML = src;
[10041] Fix | Delete
[10042] Fix | Delete
var globals = {
[10043] Fix | Delete
preList: substitutePreCodeTags(doc)
[10044] Fix | Delete
};
[10045] Fix | Delete
[10046] Fix | Delete
// remove all newlines and collapse spaces
[10047] Fix | Delete
clean(doc);
[10048] Fix | Delete
[10049] Fix | Delete
// some stuff, like accidental reference links must now be escaped
[10050] Fix | Delete
// TODO
[10051] Fix | Delete
// doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
[10052] Fix | Delete
[10053] Fix | Delete
var nodes = doc.childNodes,
[10054] Fix | Delete
mdDoc = '';
[10055] Fix | Delete
[10056] Fix | Delete
for (var i = 0; i < nodes.length; i++) {
[10057] Fix | Delete
mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals);
[10058] Fix | Delete
}
[10059] Fix | Delete
[10060] Fix | Delete
function clean (node) {
[10061] Fix | Delete
for (var n = 0; n < node.childNodes.length; ++n) {
[10062] Fix | Delete
var child = node.childNodes[n];
[10063] Fix | Delete
if (child.nodeType === 3) {
[10064] Fix | Delete
if (!/\S/.test(child.nodeValue)) {
[10065] Fix | Delete
node.removeChild(child);
[10066] Fix | Delete
--n;
[10067] Fix | Delete
} else {
[10068] Fix | Delete
child.nodeValue = child.nodeValue.split('\n').join(' ');
[10069] Fix | Delete
child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
[10070] Fix | Delete
}
[10071] Fix | Delete
} else if (child.nodeType === 1) {
[10072] Fix | Delete
clean(child);
[10073] Fix | Delete
}
[10074] Fix | Delete
}
[10075] Fix | Delete
}
[10076] Fix | Delete
[10077] Fix | Delete
// find all pre tags and replace contents with placeholder
[10078] Fix | Delete
// we need this so that we can remove all indentation from html
[10079] Fix | Delete
// to ease up parsing
[10080] Fix | Delete
function substitutePreCodeTags (doc) {
[10081] Fix | Delete
[10082] Fix | Delete
var pres = doc.querySelectorAll('pre'),
[10083] Fix | Delete
presPH = [];
[10084] Fix | Delete
[10085] Fix | Delete
for (var i = 0; i < pres.length; ++i) {
[10086] Fix | Delete
[10087] Fix | Delete
if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
[10088] Fix | Delete
var content = pres[i].firstChild.innerHTML.trim(),
[10089] Fix | Delete
language = pres[i].firstChild.getAttribute('data-language') || '';
[10090] Fix | Delete
[10091] Fix | Delete
// if data-language attribute is not defined, then we look for class language-*
[10092] Fix | Delete
if (language === '') {
[10093] Fix | Delete
var classes = pres[i].firstChild.className.split(' ');
[10094] Fix | Delete
for (var c = 0; c < classes.length; ++c) {
[10095] Fix | Delete
var matches = classes[c].match(/^language-(.+)$/);
[10096] Fix | Delete
if (matches !== null) {
[10097] Fix | Delete
language = matches[1];
[10098] Fix | Delete
break;
[10099] Fix | Delete
}
[10100] Fix | Delete
}
[10101] Fix | Delete
}
[10102] Fix | Delete
[10103] Fix | Delete
// unescape html entities in content
[10104] Fix | Delete
content = showdown.helper.unescapeHTMLEntities(content);
[10105] Fix | Delete
[10106] Fix | Delete
presPH.push(content);
[10107] Fix | Delete
pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
[10108] Fix | Delete
} else {
[10109] Fix | Delete
presPH.push(pres[i].innerHTML);
[10110] Fix | Delete
pres[i].innerHTML = '';
[10111] Fix | Delete
pres[i].setAttribute('prenum', i.toString());
[10112] Fix | Delete
}
[10113] Fix | Delete
}
[10114] Fix | Delete
return presPH;
[10115] Fix | Delete
}
[10116] Fix | Delete
[10117] Fix | Delete
return mdDoc;
[10118] Fix | Delete
};
[10119] Fix | Delete
[10120] Fix | Delete
/**
[10121] Fix | Delete
* Set an option of this Converter instance
[10122] Fix | Delete
* @param {string} key
[10123] Fix | Delete
* @param {*} value
[10124] Fix | Delete
*/
[10125] Fix | Delete
this.setOption = function (key, value) {
[10126] Fix | Delete
options[key] = value;
[10127] Fix | Delete
};
[10128] Fix | Delete
[10129] Fix | Delete
/**
[10130] Fix | Delete
* Get the option of this Converter instance
[10131] Fix | Delete
* @param {string} key
[10132] Fix | Delete
* @returns {*}
[10133] Fix | Delete
*/
[10134] Fix | Delete
this.getOption = function (key) {
[10135] Fix | Delete
return options[key];
[10136] Fix | Delete
};
[10137] Fix | Delete
[10138] Fix | Delete
/**
[10139] Fix | Delete
* Get the options of this Converter instance
[10140] Fix | Delete
* @returns {{}}
[10141] Fix | Delete
*/
[10142] Fix | Delete
this.getOptions = function () {
[10143] Fix | Delete
return options;
[10144] Fix | Delete
};
[10145] Fix | Delete
[10146] Fix | Delete
/**
[10147] Fix | Delete
* Add extension to THIS converter
[10148] Fix | Delete
* @param {{}} extension
[10149] Fix | Delete
* @param {string} [name=null]
[10150] Fix | Delete
*/
[10151] Fix | Delete
this.addExtension = function (extension, name) {
[10152] Fix | Delete
name = name || null;
[10153] Fix | Delete
_parseExtension(extension, name);
[10154] Fix | Delete
};
[10155] Fix | Delete
[10156] Fix | Delete
/**
[10157] Fix | Delete
* Use a global registered extension with THIS converter
[10158] Fix | Delete
* @param {string} extensionName Name of the previously registered extension
[10159] Fix | Delete
*/
[10160] Fix | Delete
this.useExtension = function (extensionName) {
[10161] Fix | Delete
_parseExtension(extensionName);
[10162] Fix | Delete
};
[10163] Fix | Delete
[10164] Fix | Delete
/**
[10165] Fix | Delete
* Set the flavor THIS converter should use
[10166] Fix | Delete
* @param {string} name
[10167] Fix | Delete
*/
[10168] Fix | Delete
this.setFlavor = function (name) {
[10169] Fix | Delete
if (!flavor.hasOwnProperty(name)) {
[10170] Fix | Delete
throw Error(name + ' flavor was not found');
[10171] Fix | Delete
}
[10172] Fix | Delete
var preset = flavor[name];
[10173] Fix | Delete
setConvFlavor = name;
[10174] Fix | Delete
for (var option in preset) {
[10175] Fix | Delete
if (preset.hasOwnProperty(option)) {
[10176] Fix | Delete
options[option] = preset[option];
[10177] Fix | Delete
}
[10178] Fix | Delete
}
[10179] Fix | Delete
};
[10180] Fix | Delete
[10181] Fix | Delete
/**
[10182] Fix | Delete
* Get the currently set flavor of this converter
[10183] Fix | Delete
* @returns {string}
[10184] Fix | Delete
*/
[10185] Fix | Delete
this.getFlavor = function () {
[10186] Fix | Delete
return setConvFlavor;
[10187] Fix | Delete
};
[10188] Fix | Delete
[10189] Fix | Delete
/**
[10190] Fix | Delete
* Remove an extension from THIS converter.
[10191] Fix | Delete
* Note: This is a costly operation. It's better to initialize a new converter
[10192] Fix | Delete
* and specify the extensions you wish to use
[10193] Fix | Delete
* @param {Array} extension
[10194] Fix | Delete
*/
[10195] Fix | Delete
this.removeExtension = function (extension) {
[10196] Fix | Delete
if (!showdown.helper.isArray(extension)) {
[10197] Fix | Delete
extension = [extension];
[10198] Fix | Delete
}
[10199] Fix | Delete
for (var a = 0; a < extension.length; ++a) {
[10200] Fix | Delete
var ext = extension[a];
[10201] Fix | Delete
for (var i = 0; i < langExtensions.length; ++i) {
[10202] Fix | Delete
if (langExtensions[i] === ext) {
[10203] Fix | Delete
langExtensions[i].splice(i, 1);
[10204] Fix | Delete
}
[10205] Fix | Delete
}
[10206] Fix | Delete
for (var ii = 0; ii < outputModifiers.length; ++i) {
[10207] Fix | Delete
if (outputModifiers[ii] === ext) {
[10208] Fix | Delete
outputModifiers[ii].splice(i, 1);
[10209] Fix | Delete
}
[10210] Fix | Delete
}
[10211] Fix | Delete
}
[10212] Fix | Delete
};
[10213] Fix | Delete
[10214] Fix | Delete
/**
[10215] Fix | Delete
* Get all extension of THIS converter
[10216] Fix | Delete
* @returns {{language: Array, output: Array}}
[10217] Fix | Delete
*/
[10218] Fix | Delete
this.getAllExtensions = function () {
[10219] Fix | Delete
return {
[10220] Fix | Delete
language: langExtensions,
[10221] Fix | Delete
output: outputModifiers
[10222] Fix | Delete
};
[10223] Fix | Delete
};
[10224] Fix | Delete
[10225] Fix | Delete
/**
[10226] Fix | Delete
* Get the metadata of the previously parsed document
[10227] Fix | Delete
* @param raw
[10228] Fix | Delete
* @returns {string|{}}
[10229] Fix | Delete
*/
[10230] Fix | Delete
this.getMetadata = function (raw) {
[10231] Fix | Delete
if (raw) {
[10232] Fix | Delete
return metadata.raw;
[10233] Fix | Delete
} else {
[10234] Fix | Delete
return metadata.parsed;
[10235] Fix | Delete
}
[10236] Fix | Delete
};
[10237] Fix | Delete
[10238] Fix | Delete
/**
[10239] Fix | Delete
* Get the metadata format of the previously parsed document
[10240] Fix | Delete
* @returns {string}
[10241] Fix | Delete
*/
[10242] Fix | Delete
this.getMetadataFormat = function () {
[10243] Fix | Delete
return metadata.format;
[10244] Fix | Delete
};
[10245] Fix | Delete
[10246] Fix | Delete
/**
[10247] Fix | Delete
* Private: set a single key, value metadata pair
[10248] Fix | Delete
* @param {string} key
[10249] Fix | Delete
* @param {string} value
[10250] Fix | Delete
*/
[10251] Fix | Delete
this._setMetadataPair = function (key, value) {
[10252] Fix | Delete
metadata.parsed[key] = value;
[10253] Fix | Delete
};
[10254] Fix | Delete
[10255] Fix | Delete
/**
[10256] Fix | Delete
* Private: set metadata format
[10257] Fix | Delete
* @param {string} format
[10258] Fix | Delete
*/
[10259] Fix | Delete
this._setMetadataFormat = function (format) {
[10260] Fix | Delete
metadata.format = format;
[10261] Fix | Delete
};
[10262] Fix | Delete
[10263] Fix | Delete
/**
[10264] Fix | Delete
* Private: set metadata raw text
[10265] Fix | Delete
* @param {string} raw
[10266] Fix | Delete
*/
[10267] Fix | Delete
this._setMetadataRaw = function (raw) {
[10268] Fix | Delete
metadata.raw = raw;
[10269] Fix | Delete
};
[10270] Fix | Delete
};
[10271] Fix | Delete
[10272] Fix | Delete
/**
[10273] Fix | Delete
* Turn Markdown link shortcuts into XHTML <a> tags.
[10274] Fix | Delete
*/
[10275] Fix | Delete
showdown.subParser('anchors', function (text, options, globals) {
[10276] Fix | Delete
'use strict';
[10277] Fix | Delete
[10278] Fix | Delete
text = globals.converter._dispatch('anchors.before', text, options, globals);
[10279] Fix | Delete
[10280] Fix | Delete
var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
[10281] Fix | Delete
if (showdown.helper.isUndefined(title)) {
[10282] Fix | Delete
title = '';
[10283] Fix | Delete
}
[10284] Fix | Delete
linkId = linkId.toLowerCase();
[10285] Fix | Delete
[10286] Fix | Delete
// Special case for explicit empty url
[10287] Fix | Delete
if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
[10288] Fix | Delete
url = '';
[10289] Fix | Delete
} else if (!url) {
[10290] Fix | Delete
if (!linkId) {
[10291] Fix | Delete
// lower-case and turn embedded newlines into spaces
[10292] Fix | Delete
linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
[10293] Fix | Delete
}
[10294] Fix | Delete
url = '#' + linkId;
[10295] Fix | Delete
[10296] Fix | Delete
if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
[10297] Fix | Delete
url = globals.gUrls[linkId];
[10298] Fix | Delete
if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
[10299] Fix | Delete
title = globals.gTitles[linkId];
[10300] Fix | Delete
}
[10301] Fix | Delete
} else {
[10302] Fix | Delete
return wholeMatch;
[10303] Fix | Delete
}
[10304] Fix | Delete
}
[10305] Fix | Delete
[10306] Fix | Delete
//url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
[10307] Fix | Delete
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[10308] Fix | Delete
[10309] Fix | Delete
var result = '<a href="' + url + '"';
[10310] Fix | Delete
[10311] Fix | Delete
if (title !== '' && title !== null) {
[10312] Fix | Delete
title = title.replace(/"/g, '&quot;');
[10313] Fix | Delete
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
[10314] Fix | Delete
title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[10315] Fix | Delete
result += ' title="' + title + '"';
[10316] Fix | Delete
}
[10317] Fix | Delete
[10318] Fix | Delete
// optionLinksInNewWindow only applies
[10319] Fix | Delete
// to external links. Hash links (#) open in same page
[10320] Fix | Delete
if (options.openLinksInNewWindow && !/^#/.test(url)) {
[10321] Fix | Delete
// escaped _
[10322] Fix | Delete
result += ' rel="noopener noreferrer" target="¨E95Eblank"';
[10323] Fix | Delete
}
[10324] Fix | Delete
[10325] Fix | Delete
result += '>' + linkText + '</a>';
[10326] Fix | Delete
[10327] Fix | Delete
return result;
[10328] Fix | Delete
};
[10329] Fix | Delete
[10330] Fix | Delete
// First, handle reference-style links: [link text] [id]
[10331] Fix | Delete
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
[10332] Fix | Delete
[10333] Fix | Delete
// Next, inline-style links: [link text](url "optional title")
[10334] Fix | Delete
// cases with crazy urls like ./image/cat1).png
[10335] Fix | Delete
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
[10336] Fix | Delete
writeAnchorTag);
[10337] Fix | Delete
[10338] Fix | Delete
// normal cases
[10339] Fix | Delete
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
[10340] Fix | Delete
writeAnchorTag);
[10341] Fix | Delete
[10342] Fix | Delete
// handle reference-style shortcuts: [link text]
[10343] Fix | Delete
// These must come last in case you've also got [link test][1]
[10344] Fix | Delete
// or [link test](/foo)
[10345] Fix | Delete
text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
[10346] Fix | Delete
[10347] Fix | Delete
// Lastly handle GithubMentions if option is enabled
[10348] Fix | Delete
if (options.ghMentions) {
[10349] Fix | Delete
text = text.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function (wm, st, escape, mentions, username) {
[10350] Fix | Delete
if (escape === '\\') {
[10351] Fix | Delete
return st + mentions;
[10352] Fix | Delete
}
[10353] Fix | Delete
[10354] Fix | Delete
//check if options.ghMentionsLink is a string
[10355] Fix | Delete
if (!showdown.helper.isString(options.ghMentionsLink)) {
[10356] Fix | Delete
throw new Error('ghMentionsLink option must be a string');
[10357] Fix | Delete
}
[10358] Fix | Delete
var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
[10359] Fix | Delete
target = '';
[10360] Fix | Delete
if (options.openLinksInNewWindow) {
[10361] Fix | Delete
target = ' rel="noopener noreferrer" target="¨E95Eblank"';
[10362] Fix | Delete
}
[10363] Fix | Delete
return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
[10364] Fix | Delete
});
[10365] Fix | Delete
}
[10366] Fix | Delete
[10367] Fix | Delete
text = globals.converter._dispatch('anchors.after', text, options, globals);
[10368] Fix | Delete
return text;
[10369] Fix | Delete
});
[10370] Fix | Delete
[10371] Fix | Delete
// url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
[10372] Fix | Delete
[10373] Fix | Delete
var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
[10374] Fix | Delete
simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
[10375] Fix | Delete
delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
[10376] Fix | Delete
simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
[10377] Fix | Delete
delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
[10378] Fix | Delete
[10379] Fix | Delete
replaceLink = function (options) {
[10380] Fix | Delete
'use strict';
[10381] Fix | Delete
return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
[10382] Fix | Delete
link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[10383] Fix | Delete
var lnkTxt = link,
[10384] Fix | Delete
append = '',
[10385] Fix | Delete
target = '',
[10386] Fix | Delete
lmc = leadingMagicChars || '',
[10387] Fix | Delete
tmc = trailingMagicChars || '';
[10388] Fix | Delete
if (/^www\./i.test(link)) {
[10389] Fix | Delete
link = link.replace(/^www\./i, 'http://www.');
[10390] Fix | Delete
}
[10391] Fix | Delete
if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
[10392] Fix | Delete
append = trailingPunctuation;
[10393] Fix | Delete
}
[10394] Fix | Delete
if (options.openLinksInNewWindow) {
[10395] Fix | Delete
target = ' rel="noopener noreferrer" target="¨E95Eblank"';
[10396] Fix | Delete
}
[10397] Fix | Delete
return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
[10398] Fix | Delete
};
[10399] Fix | Delete
},
[10400] Fix | Delete
[10401] Fix | Delete
replaceMail = function (options, globals) {
[10402] Fix | Delete
'use strict';
[10403] Fix | Delete
return function (wholeMatch, b, mail) {
[10404] Fix | Delete
var href = 'mailto:';
[10405] Fix | Delete
b = b || '';
[10406] Fix | Delete
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
[10407] Fix | Delete
if (options.encodeEmails) {
[10408] Fix | Delete
href = showdown.helper.encodeEmailAddress(href + mail);
[10409] Fix | Delete
mail = showdown.helper.encodeEmailAddress(mail);
[10410] Fix | Delete
} else {
[10411] Fix | Delete
href = href + mail;
[10412] Fix | Delete
}
[10413] Fix | Delete
return b + '<a href="' + href + '">' + mail + '</a>';
[10414] Fix | Delete
};
[10415] Fix | Delete
};
[10416] Fix | Delete
[10417] Fix | Delete
showdown.subParser('autoLinks', function (text, options, globals) {
[10418] Fix | Delete
'use strict';
[10419] Fix | Delete
[10420] Fix | Delete
text = globals.converter._dispatch('autoLinks.before', text, options, globals);
[10421] Fix | Delete
[10422] Fix | Delete
text = text.replace(delimUrlRegex, replaceLink(options));
[10423] Fix | Delete
text = text.replace(delimMailRegex, replaceMail(options, globals));
[10424] Fix | Delete
[10425] Fix | Delete
text = globals.converter._dispatch('autoLinks.after', text, options, globals);
[10426] Fix | Delete
[10427] Fix | Delete
return text;
[10428] Fix | Delete
});
[10429] Fix | Delete
[10430] Fix | Delete
showdown.subParser('simplifiedAutoLinks', function (text, options, globals) {
[10431] Fix | Delete
'use strict';
[10432] Fix | Delete
[10433] Fix | Delete
if (!options.simplifiedAutoLink) {
[10434] Fix | Delete
return text;
[10435] Fix | Delete
}
[10436] Fix | Delete
[10437] Fix | Delete
text = globals.converter._dispatch('simplifiedAutoLinks.before', text, options, globals);
[10438] Fix | Delete
[10439] Fix | Delete
if (options.excludeTrailingPunctuationFromURLs) {
[10440] Fix | Delete
text = text.replace(simpleURLRegex2, replaceLink(options));
[10441] Fix | Delete
} else {
[10442] Fix | Delete
text = text.replace(simpleURLRegex, replaceLink(options));
[10443] Fix | Delete
}
[10444] Fix | Delete
text = text.replace(simpleMailRegex, replaceMail(options, globals));
[10445] Fix | Delete
[10446] Fix | Delete
text = globals.converter._dispatch('simplifiedAutoLinks.after', text, options, globals);
[10447] Fix | Delete
[10448] Fix | Delete
return text;
[10449] Fix | Delete
});
[10450] Fix | Delete
[10451] Fix | Delete
/**
[10452] Fix | Delete
* These are all the transformations that form block-level
[10453] Fix | Delete
* tags like paragraphs, headers, and list items.
[10454] Fix | Delete
*/
[10455] Fix | Delete
showdown.subParser('blockGamut', function (text, options, globals) {
[10456] Fix | Delete
'use strict';
[10457] Fix | Delete
[10458] Fix | Delete
text = globals.converter._dispatch('blockGamut.before', text, options, globals);
[10459] Fix | Delete
[10460] Fix | Delete
// we parse blockquotes first so that we can have headings and hrs
[10461] Fix | Delete
// inside blockquotes
[10462] Fix | Delete
text = showdown.subParser('blockQuotes')(text, options, globals);
[10463] Fix | Delete
text = showdown.subParser('headers')(text, options, globals);
[10464] Fix | Delete
[10465] Fix | Delete
// Do Horizontal Rules:
[10466] Fix | Delete
text = showdown.subParser('horizontalRule')(text, options, globals);
[10467] Fix | Delete
[10468] Fix | Delete
text = showdown.subParser('lists')(text, options, globals);
[10469] Fix | Delete
text = showdown.subParser('codeBlocks')(text, options, globals);
[10470] Fix | Delete
text = showdown.subParser('tables')(text, options, globals);
[10471] Fix | Delete
[10472] Fix | Delete
// We already ran _HashHTMLBlocks() before, in Markdown(), but that
[10473] Fix | Delete
// was to escape raw HTML in the original Markdown source. This time,
[10474] Fix | Delete
// we're escaping the markup we've just created, so that we don't wrap
[10475] Fix | Delete
// <p> tags around block-level tags.
[10476] Fix | Delete
text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
[10477] Fix | Delete
text = showdown.subParser('paragraphs')(text, options, globals);
[10478] Fix | Delete
[10479] Fix | Delete
text = globals.converter._dispatch('blockGamut.after', text, options, globals);
[10480] Fix | Delete
[10481] Fix | Delete
return text;
[10482] Fix | Delete
});
[10483] Fix | Delete
[10484] Fix | Delete
showdown.subParser('blockQuotes', function (text, options, globals) {
[10485] Fix | Delete
'use strict';
[10486] Fix | Delete
[10487] Fix | Delete
text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
[10488] Fix | Delete
[10489] Fix | Delete
// add a couple extra lines after the text and endtext mark
[10490] Fix | Delete
text = text + '\n\n';
[10491] Fix | Delete
[10492] Fix | Delete
var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
[10493] Fix | Delete
[10494] Fix | Delete
if (options.splitAdjacentBlockquotes) {
[10495] Fix | Delete
rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
[10496] Fix | Delete
}
[10497] Fix | Delete
[10498] Fix | Delete
text = text.replace(rgx, function (bq) {
[10499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function