Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: blocks.js
}
[3000] Fix | Delete
[3001] Fix | Delete
/**
[3002] Fix | Delete
* Dispatch an event
[3003] Fix | Delete
* @private
[3004] Fix | Delete
* @param {string} evtName Event name
[3005] Fix | Delete
* @param {string} text Text
[3006] Fix | Delete
* @param {{}} options Converter Options
[3007] Fix | Delete
* @param {{}} globals
[3008] Fix | Delete
* @returns {string}
[3009] Fix | Delete
*/
[3010] Fix | Delete
this._dispatch = function dispatch (evtName, text, options, globals) {
[3011] Fix | Delete
if (listeners.hasOwnProperty(evtName)) {
[3012] Fix | Delete
for (var ei = 0; ei < listeners[evtName].length; ++ei) {
[3013] Fix | Delete
var nText = listeners[evtName][ei](evtName, text, this, options, globals);
[3014] Fix | Delete
if (nText && typeof nText !== 'undefined') {
[3015] Fix | Delete
text = nText;
[3016] Fix | Delete
}
[3017] Fix | Delete
}
[3018] Fix | Delete
}
[3019] Fix | Delete
return text;
[3020] Fix | Delete
};
[3021] Fix | Delete
[3022] Fix | Delete
/**
[3023] Fix | Delete
* Listen to an event
[3024] Fix | Delete
* @param {string} name
[3025] Fix | Delete
* @param {function} callback
[3026] Fix | Delete
* @returns {showdown.Converter}
[3027] Fix | Delete
*/
[3028] Fix | Delete
this.listen = function (name, callback) {
[3029] Fix | Delete
listen(name, callback);
[3030] Fix | Delete
return this;
[3031] Fix | Delete
};
[3032] Fix | Delete
[3033] Fix | Delete
/**
[3034] Fix | Delete
* Converts a markdown string into HTML
[3035] Fix | Delete
* @param {string} text
[3036] Fix | Delete
* @returns {*}
[3037] Fix | Delete
*/
[3038] Fix | Delete
this.makeHtml = function (text) {
[3039] Fix | Delete
//check if text is not falsy
[3040] Fix | Delete
if (!text) {
[3041] Fix | Delete
return text;
[3042] Fix | Delete
}
[3043] Fix | Delete
[3044] Fix | Delete
var globals = {
[3045] Fix | Delete
gHtmlBlocks: [],
[3046] Fix | Delete
gHtmlMdBlocks: [],
[3047] Fix | Delete
gHtmlSpans: [],
[3048] Fix | Delete
gUrls: {},
[3049] Fix | Delete
gTitles: {},
[3050] Fix | Delete
gDimensions: {},
[3051] Fix | Delete
gListLevel: 0,
[3052] Fix | Delete
hashLinkCounts: {},
[3053] Fix | Delete
langExtensions: langExtensions,
[3054] Fix | Delete
outputModifiers: outputModifiers,
[3055] Fix | Delete
converter: this,
[3056] Fix | Delete
ghCodeBlocks: [],
[3057] Fix | Delete
metadata: {
[3058] Fix | Delete
parsed: {},
[3059] Fix | Delete
raw: '',
[3060] Fix | Delete
format: ''
[3061] Fix | Delete
}
[3062] Fix | Delete
};
[3063] Fix | Delete
[3064] Fix | Delete
// This lets us use ¨ trema as an escape char to avoid md5 hashes
[3065] Fix | Delete
// The choice of character is arbitrary; anything that isn't
[3066] Fix | Delete
// magic in Markdown will work.
[3067] Fix | Delete
text = text.replace(/¨/g, '¨T');
[3068] Fix | Delete
[3069] Fix | Delete
// Replace $ with ¨D
[3070] Fix | Delete
// RegExp interprets $ as a special character
[3071] Fix | Delete
// when it's in a replacement string
[3072] Fix | Delete
text = text.replace(/\$/g, '¨D');
[3073] Fix | Delete
[3074] Fix | Delete
// Standardize line endings
[3075] Fix | Delete
text = text.replace(/\r\n/g, '\n'); // DOS to Unix
[3076] Fix | Delete
text = text.replace(/\r/g, '\n'); // Mac to Unix
[3077] Fix | Delete
[3078] Fix | Delete
// Stardardize line spaces
[3079] Fix | Delete
text = text.replace(/\u00A0/g, '&nbsp;');
[3080] Fix | Delete
[3081] Fix | Delete
if (options.smartIndentationFix) {
[3082] Fix | Delete
text = rTrimInputText(text);
[3083] Fix | Delete
}
[3084] Fix | Delete
[3085] Fix | Delete
// Make sure text begins and ends with a couple of newlines:
[3086] Fix | Delete
text = '\n\n' + text + '\n\n';
[3087] Fix | Delete
[3088] Fix | Delete
// detab
[3089] Fix | Delete
text = showdown.subParser('detab')(text, options, globals);
[3090] Fix | Delete
[3091] Fix | Delete
/**
[3092] Fix | Delete
* Strip any lines consisting only of spaces and tabs.
[3093] Fix | Delete
* This makes subsequent regexs easier to write, because we can
[3094] Fix | Delete
* match consecutive blank lines with /\n+/ instead of something
[3095] Fix | Delete
* contorted like /[ \t]*\n+/
[3096] Fix | Delete
*/
[3097] Fix | Delete
text = text.replace(/^[ \t]+$/mg, '');
[3098] Fix | Delete
[3099] Fix | Delete
//run languageExtensions
[3100] Fix | Delete
showdown.helper.forEach(langExtensions, function (ext) {
[3101] Fix | Delete
text = showdown.subParser('runExtension')(ext, text, options, globals);
[3102] Fix | Delete
});
[3103] Fix | Delete
[3104] Fix | Delete
// run the sub parsers
[3105] Fix | Delete
text = showdown.subParser('metadata')(text, options, globals);
[3106] Fix | Delete
text = showdown.subParser('hashPreCodeTags')(text, options, globals);
[3107] Fix | Delete
text = showdown.subParser('githubCodeBlocks')(text, options, globals);
[3108] Fix | Delete
text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
[3109] Fix | Delete
text = showdown.subParser('hashCodeTags')(text, options, globals);
[3110] Fix | Delete
text = showdown.subParser('stripLinkDefinitions')(text, options, globals);
[3111] Fix | Delete
text = showdown.subParser('blockGamut')(text, options, globals);
[3112] Fix | Delete
text = showdown.subParser('unhashHTMLSpans')(text, options, globals);
[3113] Fix | Delete
text = showdown.subParser('unescapeSpecialChars')(text, options, globals);
[3114] Fix | Delete
[3115] Fix | Delete
// attacklab: Restore dollar signs
[3116] Fix | Delete
text = text.replace(/¨D/g, '$$');
[3117] Fix | Delete
[3118] Fix | Delete
// attacklab: Restore tremas
[3119] Fix | Delete
text = text.replace(/¨T/g, '¨');
[3120] Fix | Delete
[3121] Fix | Delete
// render a complete html document instead of a partial if the option is enabled
[3122] Fix | Delete
text = showdown.subParser('completeHTMLDocument')(text, options, globals);
[3123] Fix | Delete
[3124] Fix | Delete
// Run output modifiers
[3125] Fix | Delete
showdown.helper.forEach(outputModifiers, function (ext) {
[3126] Fix | Delete
text = showdown.subParser('runExtension')(ext, text, options, globals);
[3127] Fix | Delete
});
[3128] Fix | Delete
[3129] Fix | Delete
// update metadata
[3130] Fix | Delete
metadata = globals.metadata;
[3131] Fix | Delete
return text;
[3132] Fix | Delete
};
[3133] Fix | Delete
[3134] Fix | Delete
/**
[3135] Fix | Delete
* Converts an HTML string into a markdown string
[3136] Fix | Delete
* @param src
[3137] Fix | Delete
* @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
[3138] Fix | Delete
* @returns {string}
[3139] Fix | Delete
*/
[3140] Fix | Delete
this.makeMarkdown = this.makeMd = function (src, HTMLParser) {
[3141] Fix | Delete
[3142] Fix | Delete
// replace \r\n with \n
[3143] Fix | Delete
src = src.replace(/\r\n/g, '\n');
[3144] Fix | Delete
src = src.replace(/\r/g, '\n'); // old macs
[3145] Fix | Delete
[3146] Fix | Delete
// due to an edge case, we need to find this: > <
[3147] Fix | Delete
// to prevent removing of non silent white spaces
[3148] Fix | Delete
// ex: <em>this is</em> <strong>sparta</strong>
[3149] Fix | Delete
src = src.replace(/>[ \t]+</, '>¨NBSP;<');
[3150] Fix | Delete
[3151] Fix | Delete
if (!HTMLParser) {
[3152] Fix | Delete
if (window && window.document) {
[3153] Fix | Delete
HTMLParser = window.document;
[3154] Fix | Delete
} else {
[3155] 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');
[3156] Fix | Delete
}
[3157] Fix | Delete
}
[3158] Fix | Delete
[3159] Fix | Delete
var doc = HTMLParser.createElement('div');
[3160] Fix | Delete
doc.innerHTML = src;
[3161] Fix | Delete
[3162] Fix | Delete
var globals = {
[3163] Fix | Delete
preList: substitutePreCodeTags(doc)
[3164] Fix | Delete
};
[3165] Fix | Delete
[3166] Fix | Delete
// remove all newlines and collapse spaces
[3167] Fix | Delete
clean(doc);
[3168] Fix | Delete
[3169] Fix | Delete
// some stuff, like accidental reference links must now be escaped
[3170] Fix | Delete
// TODO
[3171] Fix | Delete
// doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
[3172] Fix | Delete
[3173] Fix | Delete
var nodes = doc.childNodes,
[3174] Fix | Delete
mdDoc = '';
[3175] Fix | Delete
[3176] Fix | Delete
for (var i = 0; i < nodes.length; i++) {
[3177] Fix | Delete
mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals);
[3178] Fix | Delete
}
[3179] Fix | Delete
[3180] Fix | Delete
function clean (node) {
[3181] Fix | Delete
for (var n = 0; n < node.childNodes.length; ++n) {
[3182] Fix | Delete
var child = node.childNodes[n];
[3183] Fix | Delete
if (child.nodeType === 3) {
[3184] Fix | Delete
if (!/\S/.test(child.nodeValue)) {
[3185] Fix | Delete
node.removeChild(child);
[3186] Fix | Delete
--n;
[3187] Fix | Delete
} else {
[3188] Fix | Delete
child.nodeValue = child.nodeValue.split('\n').join(' ');
[3189] Fix | Delete
child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
[3190] Fix | Delete
}
[3191] Fix | Delete
} else if (child.nodeType === 1) {
[3192] Fix | Delete
clean(child);
[3193] Fix | Delete
}
[3194] Fix | Delete
}
[3195] Fix | Delete
}
[3196] Fix | Delete
[3197] Fix | Delete
// find all pre tags and replace contents with placeholder
[3198] Fix | Delete
// we need this so that we can remove all indentation from html
[3199] Fix | Delete
// to ease up parsing
[3200] Fix | Delete
function substitutePreCodeTags (doc) {
[3201] Fix | Delete
[3202] Fix | Delete
var pres = doc.querySelectorAll('pre'),
[3203] Fix | Delete
presPH = [];
[3204] Fix | Delete
[3205] Fix | Delete
for (var i = 0; i < pres.length; ++i) {
[3206] Fix | Delete
[3207] Fix | Delete
if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
[3208] Fix | Delete
var content = pres[i].firstChild.innerHTML.trim(),
[3209] Fix | Delete
language = pres[i].firstChild.getAttribute('data-language') || '';
[3210] Fix | Delete
[3211] Fix | Delete
// if data-language attribute is not defined, then we look for class language-*
[3212] Fix | Delete
if (language === '') {
[3213] Fix | Delete
var classes = pres[i].firstChild.className.split(' ');
[3214] Fix | Delete
for (var c = 0; c < classes.length; ++c) {
[3215] Fix | Delete
var matches = classes[c].match(/^language-(.+)$/);
[3216] Fix | Delete
if (matches !== null) {
[3217] Fix | Delete
language = matches[1];
[3218] Fix | Delete
break;
[3219] Fix | Delete
}
[3220] Fix | Delete
}
[3221] Fix | Delete
}
[3222] Fix | Delete
[3223] Fix | Delete
// unescape html entities in content
[3224] Fix | Delete
content = showdown.helper.unescapeHTMLEntities(content);
[3225] Fix | Delete
[3226] Fix | Delete
presPH.push(content);
[3227] Fix | Delete
pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
[3228] Fix | Delete
} else {
[3229] Fix | Delete
presPH.push(pres[i].innerHTML);
[3230] Fix | Delete
pres[i].innerHTML = '';
[3231] Fix | Delete
pres[i].setAttribute('prenum', i.toString());
[3232] Fix | Delete
}
[3233] Fix | Delete
}
[3234] Fix | Delete
return presPH;
[3235] Fix | Delete
}
[3236] Fix | Delete
[3237] Fix | Delete
return mdDoc;
[3238] Fix | Delete
};
[3239] Fix | Delete
[3240] Fix | Delete
/**
[3241] Fix | Delete
* Set an option of this Converter instance
[3242] Fix | Delete
* @param {string} key
[3243] Fix | Delete
* @param {*} value
[3244] Fix | Delete
*/
[3245] Fix | Delete
this.setOption = function (key, value) {
[3246] Fix | Delete
options[key] = value;
[3247] Fix | Delete
};
[3248] Fix | Delete
[3249] Fix | Delete
/**
[3250] Fix | Delete
* Get the option of this Converter instance
[3251] Fix | Delete
* @param {string} key
[3252] Fix | Delete
* @returns {*}
[3253] Fix | Delete
*/
[3254] Fix | Delete
this.getOption = function (key) {
[3255] Fix | Delete
return options[key];
[3256] Fix | Delete
};
[3257] Fix | Delete
[3258] Fix | Delete
/**
[3259] Fix | Delete
* Get the options of this Converter instance
[3260] Fix | Delete
* @returns {{}}
[3261] Fix | Delete
*/
[3262] Fix | Delete
this.getOptions = function () {
[3263] Fix | Delete
return options;
[3264] Fix | Delete
};
[3265] Fix | Delete
[3266] Fix | Delete
/**
[3267] Fix | Delete
* Add extension to THIS converter
[3268] Fix | Delete
* @param {{}} extension
[3269] Fix | Delete
* @param {string} [name=null]
[3270] Fix | Delete
*/
[3271] Fix | Delete
this.addExtension = function (extension, name) {
[3272] Fix | Delete
name = name || null;
[3273] Fix | Delete
_parseExtension(extension, name);
[3274] Fix | Delete
};
[3275] Fix | Delete
[3276] Fix | Delete
/**
[3277] Fix | Delete
* Use a global registered extension with THIS converter
[3278] Fix | Delete
* @param {string} extensionName Name of the previously registered extension
[3279] Fix | Delete
*/
[3280] Fix | Delete
this.useExtension = function (extensionName) {
[3281] Fix | Delete
_parseExtension(extensionName);
[3282] Fix | Delete
};
[3283] Fix | Delete
[3284] Fix | Delete
/**
[3285] Fix | Delete
* Set the flavor THIS converter should use
[3286] Fix | Delete
* @param {string} name
[3287] Fix | Delete
*/
[3288] Fix | Delete
this.setFlavor = function (name) {
[3289] Fix | Delete
if (!flavor.hasOwnProperty(name)) {
[3290] Fix | Delete
throw Error(name + ' flavor was not found');
[3291] Fix | Delete
}
[3292] Fix | Delete
var preset = flavor[name];
[3293] Fix | Delete
setConvFlavor = name;
[3294] Fix | Delete
for (var option in preset) {
[3295] Fix | Delete
if (preset.hasOwnProperty(option)) {
[3296] Fix | Delete
options[option] = preset[option];
[3297] Fix | Delete
}
[3298] Fix | Delete
}
[3299] Fix | Delete
};
[3300] Fix | Delete
[3301] Fix | Delete
/**
[3302] Fix | Delete
* Get the currently set flavor of this converter
[3303] Fix | Delete
* @returns {string}
[3304] Fix | Delete
*/
[3305] Fix | Delete
this.getFlavor = function () {
[3306] Fix | Delete
return setConvFlavor;
[3307] Fix | Delete
};
[3308] Fix | Delete
[3309] Fix | Delete
/**
[3310] Fix | Delete
* Remove an extension from THIS converter.
[3311] Fix | Delete
* Note: This is a costly operation. It's better to initialize a new converter
[3312] Fix | Delete
* and specify the extensions you wish to use
[3313] Fix | Delete
* @param {Array} extension
[3314] Fix | Delete
*/
[3315] Fix | Delete
this.removeExtension = function (extension) {
[3316] Fix | Delete
if (!showdown.helper.isArray(extension)) {
[3317] Fix | Delete
extension = [extension];
[3318] Fix | Delete
}
[3319] Fix | Delete
for (var a = 0; a < extension.length; ++a) {
[3320] Fix | Delete
var ext = extension[a];
[3321] Fix | Delete
for (var i = 0; i < langExtensions.length; ++i) {
[3322] Fix | Delete
if (langExtensions[i] === ext) {
[3323] Fix | Delete
langExtensions[i].splice(i, 1);
[3324] Fix | Delete
}
[3325] Fix | Delete
}
[3326] Fix | Delete
for (var ii = 0; ii < outputModifiers.length; ++i) {
[3327] Fix | Delete
if (outputModifiers[ii] === ext) {
[3328] Fix | Delete
outputModifiers[ii].splice(i, 1);
[3329] Fix | Delete
}
[3330] Fix | Delete
}
[3331] Fix | Delete
}
[3332] Fix | Delete
};
[3333] Fix | Delete
[3334] Fix | Delete
/**
[3335] Fix | Delete
* Get all extension of THIS converter
[3336] Fix | Delete
* @returns {{language: Array, output: Array}}
[3337] Fix | Delete
*/
[3338] Fix | Delete
this.getAllExtensions = function () {
[3339] Fix | Delete
return {
[3340] Fix | Delete
language: langExtensions,
[3341] Fix | Delete
output: outputModifiers
[3342] Fix | Delete
};
[3343] Fix | Delete
};
[3344] Fix | Delete
[3345] Fix | Delete
/**
[3346] Fix | Delete
* Get the metadata of the previously parsed document
[3347] Fix | Delete
* @param raw
[3348] Fix | Delete
* @returns {string|{}}
[3349] Fix | Delete
*/
[3350] Fix | Delete
this.getMetadata = function (raw) {
[3351] Fix | Delete
if (raw) {
[3352] Fix | Delete
return metadata.raw;
[3353] Fix | Delete
} else {
[3354] Fix | Delete
return metadata.parsed;
[3355] Fix | Delete
}
[3356] Fix | Delete
};
[3357] Fix | Delete
[3358] Fix | Delete
/**
[3359] Fix | Delete
* Get the metadata format of the previously parsed document
[3360] Fix | Delete
* @returns {string}
[3361] Fix | Delete
*/
[3362] Fix | Delete
this.getMetadataFormat = function () {
[3363] Fix | Delete
return metadata.format;
[3364] Fix | Delete
};
[3365] Fix | Delete
[3366] Fix | Delete
/**
[3367] Fix | Delete
* Private: set a single key, value metadata pair
[3368] Fix | Delete
* @param {string} key
[3369] Fix | Delete
* @param {string} value
[3370] Fix | Delete
*/
[3371] Fix | Delete
this._setMetadataPair = function (key, value) {
[3372] Fix | Delete
metadata.parsed[key] = value;
[3373] Fix | Delete
};
[3374] Fix | Delete
[3375] Fix | Delete
/**
[3376] Fix | Delete
* Private: set metadata format
[3377] Fix | Delete
* @param {string} format
[3378] Fix | Delete
*/
[3379] Fix | Delete
this._setMetadataFormat = function (format) {
[3380] Fix | Delete
metadata.format = format;
[3381] Fix | Delete
};
[3382] Fix | Delete
[3383] Fix | Delete
/**
[3384] Fix | Delete
* Private: set metadata raw text
[3385] Fix | Delete
* @param {string} raw
[3386] Fix | Delete
*/
[3387] Fix | Delete
this._setMetadataRaw = function (raw) {
[3388] Fix | Delete
metadata.raw = raw;
[3389] Fix | Delete
};
[3390] Fix | Delete
};
[3391] Fix | Delete
[3392] Fix | Delete
/**
[3393] Fix | Delete
* Turn Markdown link shortcuts into XHTML <a> tags.
[3394] Fix | Delete
*/
[3395] Fix | Delete
showdown.subParser('anchors', function (text, options, globals) {
[3396] Fix | Delete
'use strict';
[3397] Fix | Delete
[3398] Fix | Delete
text = globals.converter._dispatch('anchors.before', text, options, globals);
[3399] Fix | Delete
[3400] Fix | Delete
var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
[3401] Fix | Delete
if (showdown.helper.isUndefined(title)) {
[3402] Fix | Delete
title = '';
[3403] Fix | Delete
}
[3404] Fix | Delete
linkId = linkId.toLowerCase();
[3405] Fix | Delete
[3406] Fix | Delete
// Special case for explicit empty url
[3407] Fix | Delete
if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
[3408] Fix | Delete
url = '';
[3409] Fix | Delete
} else if (!url) {
[3410] Fix | Delete
if (!linkId) {
[3411] Fix | Delete
// lower-case and turn embedded newlines into spaces
[3412] Fix | Delete
linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
[3413] Fix | Delete
}
[3414] Fix | Delete
url = '#' + linkId;
[3415] Fix | Delete
[3416] Fix | Delete
if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
[3417] Fix | Delete
url = globals.gUrls[linkId];
[3418] Fix | Delete
if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
[3419] Fix | Delete
title = globals.gTitles[linkId];
[3420] Fix | Delete
}
[3421] Fix | Delete
} else {
[3422] Fix | Delete
return wholeMatch;
[3423] Fix | Delete
}
[3424] Fix | Delete
}
[3425] Fix | Delete
[3426] Fix | Delete
//url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
[3427] Fix | Delete
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[3428] Fix | Delete
[3429] Fix | Delete
var result = '<a href="' + url + '"';
[3430] Fix | Delete
[3431] Fix | Delete
if (title !== '' && title !== null) {
[3432] Fix | Delete
title = title.replace(/"/g, '&quot;');
[3433] Fix | Delete
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
[3434] Fix | Delete
title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[3435] Fix | Delete
result += ' title="' + title + '"';
[3436] Fix | Delete
}
[3437] Fix | Delete
[3438] Fix | Delete
// optionLinksInNewWindow only applies
[3439] Fix | Delete
// to external links. Hash links (#) open in same page
[3440] Fix | Delete
if (options.openLinksInNewWindow && !/^#/.test(url)) {
[3441] Fix | Delete
// escaped _
[3442] Fix | Delete
result += ' rel="noopener noreferrer" target="¨E95Eblank"';
[3443] Fix | Delete
}
[3444] Fix | Delete
[3445] Fix | Delete
result += '>' + linkText + '</a>';
[3446] Fix | Delete
[3447] Fix | Delete
return result;
[3448] Fix | Delete
};
[3449] Fix | Delete
[3450] Fix | Delete
// First, handle reference-style links: [link text] [id]
[3451] Fix | Delete
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
[3452] Fix | Delete
[3453] Fix | Delete
// Next, inline-style links: [link text](url "optional title")
[3454] Fix | Delete
// cases with crazy urls like ./image/cat1).png
[3455] Fix | Delete
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
[3456] Fix | Delete
writeAnchorTag);
[3457] Fix | Delete
[3458] Fix | Delete
// normal cases
[3459] Fix | Delete
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
[3460] Fix | Delete
writeAnchorTag);
[3461] Fix | Delete
[3462] Fix | Delete
// handle reference-style shortcuts: [link text]
[3463] Fix | Delete
// These must come last in case you've also got [link test][1]
[3464] Fix | Delete
// or [link test](/foo)
[3465] Fix | Delete
text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
[3466] Fix | Delete
[3467] Fix | Delete
// Lastly handle GithubMentions if option is enabled
[3468] Fix | Delete
if (options.ghMentions) {
[3469] Fix | Delete
text = text.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function (wm, st, escape, mentions, username) {
[3470] Fix | Delete
if (escape === '\\') {
[3471] Fix | Delete
return st + mentions;
[3472] Fix | Delete
}
[3473] Fix | Delete
[3474] Fix | Delete
//check if options.ghMentionsLink is a string
[3475] Fix | Delete
if (!showdown.helper.isString(options.ghMentionsLink)) {
[3476] Fix | Delete
throw new Error('ghMentionsLink option must be a string');
[3477] Fix | Delete
}
[3478] Fix | Delete
var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
[3479] Fix | Delete
target = '';
[3480] Fix | Delete
if (options.openLinksInNewWindow) {
[3481] Fix | Delete
target = ' rel="noopener noreferrer" target="¨E95Eblank"';
[3482] Fix | Delete
}
[3483] Fix | Delete
return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
[3484] Fix | Delete
});
[3485] Fix | Delete
}
[3486] Fix | Delete
[3487] Fix | Delete
text = globals.converter._dispatch('anchors.after', text, options, globals);
[3488] Fix | Delete
return text;
[3489] Fix | Delete
});
[3490] Fix | Delete
[3491] Fix | Delete
// url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
[3492] Fix | Delete
[3493] Fix | Delete
var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
[3494] Fix | Delete
simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
[3495] Fix | Delete
delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
[3496] Fix | Delete
simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
[3497] Fix | Delete
delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
[3498] Fix | Delete
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function