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
replaceLink = function (options) {
[3500] Fix | Delete
'use strict';
[3501] Fix | Delete
return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
[3502] Fix | Delete
link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[3503] Fix | Delete
var lnkTxt = link,
[3504] Fix | Delete
append = '',
[3505] Fix | Delete
target = '',
[3506] Fix | Delete
lmc = leadingMagicChars || '',
[3507] Fix | Delete
tmc = trailingMagicChars || '';
[3508] Fix | Delete
if (/^www\./i.test(link)) {
[3509] Fix | Delete
link = link.replace(/^www\./i, 'http://www.');
[3510] Fix | Delete
}
[3511] Fix | Delete
if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
[3512] Fix | Delete
append = trailingPunctuation;
[3513] Fix | Delete
}
[3514] Fix | Delete
if (options.openLinksInNewWindow) {
[3515] Fix | Delete
target = ' rel="noopener noreferrer" target="¨E95Eblank"';
[3516] Fix | Delete
}
[3517] Fix | Delete
return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
[3518] Fix | Delete
};
[3519] Fix | Delete
},
[3520] Fix | Delete
[3521] Fix | Delete
replaceMail = function (options, globals) {
[3522] Fix | Delete
'use strict';
[3523] Fix | Delete
return function (wholeMatch, b, mail) {
[3524] Fix | Delete
var href = 'mailto:';
[3525] Fix | Delete
b = b || '';
[3526] Fix | Delete
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
[3527] Fix | Delete
if (options.encodeEmails) {
[3528] Fix | Delete
href = showdown.helper.encodeEmailAddress(href + mail);
[3529] Fix | Delete
mail = showdown.helper.encodeEmailAddress(mail);
[3530] Fix | Delete
} else {
[3531] Fix | Delete
href = href + mail;
[3532] Fix | Delete
}
[3533] Fix | Delete
return b + '<a href="' + href + '">' + mail + '</a>';
[3534] Fix | Delete
};
[3535] Fix | Delete
};
[3536] Fix | Delete
[3537] Fix | Delete
showdown.subParser('autoLinks', function (text, options, globals) {
[3538] Fix | Delete
'use strict';
[3539] Fix | Delete
[3540] Fix | Delete
text = globals.converter._dispatch('autoLinks.before', text, options, globals);
[3541] Fix | Delete
[3542] Fix | Delete
text = text.replace(delimUrlRegex, replaceLink(options));
[3543] Fix | Delete
text = text.replace(delimMailRegex, replaceMail(options, globals));
[3544] Fix | Delete
[3545] Fix | Delete
text = globals.converter._dispatch('autoLinks.after', text, options, globals);
[3546] Fix | Delete
[3547] Fix | Delete
return text;
[3548] Fix | Delete
});
[3549] Fix | Delete
[3550] Fix | Delete
showdown.subParser('simplifiedAutoLinks', function (text, options, globals) {
[3551] Fix | Delete
'use strict';
[3552] Fix | Delete
[3553] Fix | Delete
if (!options.simplifiedAutoLink) {
[3554] Fix | Delete
return text;
[3555] Fix | Delete
}
[3556] Fix | Delete
[3557] Fix | Delete
text = globals.converter._dispatch('simplifiedAutoLinks.before', text, options, globals);
[3558] Fix | Delete
[3559] Fix | Delete
if (options.excludeTrailingPunctuationFromURLs) {
[3560] Fix | Delete
text = text.replace(simpleURLRegex2, replaceLink(options));
[3561] Fix | Delete
} else {
[3562] Fix | Delete
text = text.replace(simpleURLRegex, replaceLink(options));
[3563] Fix | Delete
}
[3564] Fix | Delete
text = text.replace(simpleMailRegex, replaceMail(options, globals));
[3565] Fix | Delete
[3566] Fix | Delete
text = globals.converter._dispatch('simplifiedAutoLinks.after', text, options, globals);
[3567] Fix | Delete
[3568] Fix | Delete
return text;
[3569] Fix | Delete
});
[3570] Fix | Delete
[3571] Fix | Delete
/**
[3572] Fix | Delete
* These are all the transformations that form block-level
[3573] Fix | Delete
* tags like paragraphs, headers, and list items.
[3574] Fix | Delete
*/
[3575] Fix | Delete
showdown.subParser('blockGamut', function (text, options, globals) {
[3576] Fix | Delete
'use strict';
[3577] Fix | Delete
[3578] Fix | Delete
text = globals.converter._dispatch('blockGamut.before', text, options, globals);
[3579] Fix | Delete
[3580] Fix | Delete
// we parse blockquotes first so that we can have headings and hrs
[3581] Fix | Delete
// inside blockquotes
[3582] Fix | Delete
text = showdown.subParser('blockQuotes')(text, options, globals);
[3583] Fix | Delete
text = showdown.subParser('headers')(text, options, globals);
[3584] Fix | Delete
[3585] Fix | Delete
// Do Horizontal Rules:
[3586] Fix | Delete
text = showdown.subParser('horizontalRule')(text, options, globals);
[3587] Fix | Delete
[3588] Fix | Delete
text = showdown.subParser('lists')(text, options, globals);
[3589] Fix | Delete
text = showdown.subParser('codeBlocks')(text, options, globals);
[3590] Fix | Delete
text = showdown.subParser('tables')(text, options, globals);
[3591] Fix | Delete
[3592] Fix | Delete
// We already ran _HashHTMLBlocks() before, in Markdown(), but that
[3593] Fix | Delete
// was to escape raw HTML in the original Markdown source. This time,
[3594] Fix | Delete
// we're escaping the markup we've just created, so that we don't wrap
[3595] Fix | Delete
// <p> tags around block-level tags.
[3596] Fix | Delete
text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
[3597] Fix | Delete
text = showdown.subParser('paragraphs')(text, options, globals);
[3598] Fix | Delete
[3599] Fix | Delete
text = globals.converter._dispatch('blockGamut.after', text, options, globals);
[3600] Fix | Delete
[3601] Fix | Delete
return text;
[3602] Fix | Delete
});
[3603] Fix | Delete
[3604] Fix | Delete
showdown.subParser('blockQuotes', function (text, options, globals) {
[3605] Fix | Delete
'use strict';
[3606] Fix | Delete
[3607] Fix | Delete
text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
[3608] Fix | Delete
[3609] Fix | Delete
// add a couple extra lines after the text and endtext mark
[3610] Fix | Delete
text = text + '\n\n';
[3611] Fix | Delete
[3612] Fix | Delete
var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
[3613] Fix | Delete
[3614] Fix | Delete
if (options.splitAdjacentBlockquotes) {
[3615] Fix | Delete
rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
[3616] Fix | Delete
}
[3617] Fix | Delete
[3618] Fix | Delete
text = text.replace(rgx, function (bq) {
[3619] Fix | Delete
// attacklab: hack around Konqueror 3.5.4 bug:
[3620] Fix | Delete
// "----------bug".replace(/^-/g,"") == "bug"
[3621] Fix | Delete
bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
[3622] Fix | Delete
[3623] Fix | Delete
// attacklab: clean up hack
[3624] Fix | Delete
bq = bq.replace(/¨0/g, '');
[3625] Fix | Delete
[3626] Fix | Delete
bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
[3627] Fix | Delete
bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
[3628] Fix | Delete
bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
[3629] Fix | Delete
[3630] Fix | Delete
bq = bq.replace(/(^|\n)/g, '$1 ');
[3631] Fix | Delete
// These leading spaces screw with <pre> content, so we need to fix that:
[3632] Fix | Delete
bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
[3633] Fix | Delete
var pre = m1;
[3634] Fix | Delete
// attacklab: hack around Konqueror 3.5.4 bug:
[3635] Fix | Delete
pre = pre.replace(/^ /mg, '¨0');
[3636] Fix | Delete
pre = pre.replace(/¨0/g, '');
[3637] Fix | Delete
return pre;
[3638] Fix | Delete
});
[3639] Fix | Delete
[3640] Fix | Delete
return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
[3641] Fix | Delete
});
[3642] Fix | Delete
[3643] Fix | Delete
text = globals.converter._dispatch('blockQuotes.after', text, options, globals);
[3644] Fix | Delete
return text;
[3645] Fix | Delete
});
[3646] Fix | Delete
[3647] Fix | Delete
/**
[3648] Fix | Delete
* Process Markdown `<pre><code>` blocks.
[3649] Fix | Delete
*/
[3650] Fix | Delete
showdown.subParser('codeBlocks', function (text, options, globals) {
[3651] Fix | Delete
'use strict';
[3652] Fix | Delete
[3653] Fix | Delete
text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
[3654] Fix | Delete
[3655] Fix | Delete
// sentinel workarounds for lack of \A and \Z, safari\khtml bug
[3656] Fix | Delete
text += '¨0';
[3657] Fix | Delete
[3658] Fix | Delete
var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
[3659] Fix | Delete
text = text.replace(pattern, function (wholeMatch, m1, m2) {
[3660] Fix | Delete
var codeblock = m1,
[3661] Fix | Delete
nextChar = m2,
[3662] Fix | Delete
end = '\n';
[3663] Fix | Delete
[3664] Fix | Delete
codeblock = showdown.subParser('outdent')(codeblock, options, globals);
[3665] Fix | Delete
codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
[3666] Fix | Delete
codeblock = showdown.subParser('detab')(codeblock, options, globals);
[3667] Fix | Delete
codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
[3668] Fix | Delete
codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
[3669] Fix | Delete
[3670] Fix | Delete
if (options.omitExtraWLInCodeBlocks) {
[3671] Fix | Delete
end = '';
[3672] Fix | Delete
}
[3673] Fix | Delete
[3674] Fix | Delete
codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
[3675] Fix | Delete
[3676] Fix | Delete
return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
[3677] Fix | Delete
});
[3678] Fix | Delete
[3679] Fix | Delete
// strip sentinel
[3680] Fix | Delete
text = text.replace(/¨0/, '');
[3681] Fix | Delete
[3682] Fix | Delete
text = globals.converter._dispatch('codeBlocks.after', text, options, globals);
[3683] Fix | Delete
return text;
[3684] Fix | Delete
});
[3685] Fix | Delete
[3686] Fix | Delete
/**
[3687] Fix | Delete
*
[3688] Fix | Delete
* * Backtick quotes are used for <code></code> spans.
[3689] Fix | Delete
*
[3690] Fix | Delete
* * You can use multiple backticks as the delimiters if you want to
[3691] Fix | Delete
* include literal backticks in the code span. So, this input:
[3692] Fix | Delete
*
[3693] Fix | Delete
* Just type ``foo `bar` baz`` at the prompt.
[3694] Fix | Delete
*
[3695] Fix | Delete
* Will translate to:
[3696] Fix | Delete
*
[3697] Fix | Delete
* <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
[3698] Fix | Delete
*
[3699] Fix | Delete
* There's no arbitrary limit to the number of backticks you
[3700] Fix | Delete
* can use as delimters. If you need three consecutive backticks
[3701] Fix | Delete
* in your code, use four for delimiters, etc.
[3702] Fix | Delete
*
[3703] Fix | Delete
* * You can use spaces to get literal backticks at the edges:
[3704] Fix | Delete
*
[3705] Fix | Delete
* ... type `` `bar` `` ...
[3706] Fix | Delete
*
[3707] Fix | Delete
* Turns to:
[3708] Fix | Delete
*
[3709] Fix | Delete
* ... type <code>`bar`</code> ...
[3710] Fix | Delete
*/
[3711] Fix | Delete
showdown.subParser('codeSpans', function (text, options, globals) {
[3712] Fix | Delete
'use strict';
[3713] Fix | Delete
[3714] Fix | Delete
text = globals.converter._dispatch('codeSpans.before', text, options, globals);
[3715] Fix | Delete
[3716] Fix | Delete
if (typeof text === 'undefined') {
[3717] Fix | Delete
text = '';
[3718] Fix | Delete
}
[3719] Fix | Delete
text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
[3720] Fix | Delete
function (wholeMatch, m1, m2, m3) {
[3721] Fix | Delete
var c = m3;
[3722] Fix | Delete
c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
[3723] Fix | Delete
c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
[3724] Fix | Delete
c = showdown.subParser('encodeCode')(c, options, globals);
[3725] Fix | Delete
c = m1 + '<code>' + c + '</code>';
[3726] Fix | Delete
c = showdown.subParser('hashHTMLSpans')(c, options, globals);
[3727] Fix | Delete
return c;
[3728] Fix | Delete
}
[3729] Fix | Delete
);
[3730] Fix | Delete
[3731] Fix | Delete
text = globals.converter._dispatch('codeSpans.after', text, options, globals);
[3732] Fix | Delete
return text;
[3733] Fix | Delete
});
[3734] Fix | Delete
[3735] Fix | Delete
/**
[3736] Fix | Delete
* Create a full HTML document from the processed markdown
[3737] Fix | Delete
*/
[3738] Fix | Delete
showdown.subParser('completeHTMLDocument', function (text, options, globals) {
[3739] Fix | Delete
'use strict';
[3740] Fix | Delete
[3741] Fix | Delete
if (!options.completeHTMLDocument) {
[3742] Fix | Delete
return text;
[3743] Fix | Delete
}
[3744] Fix | Delete
[3745] Fix | Delete
text = globals.converter._dispatch('completeHTMLDocument.before', text, options, globals);
[3746] Fix | Delete
[3747] Fix | Delete
var doctype = 'html',
[3748] Fix | Delete
doctypeParsed = '<!DOCTYPE HTML>\n',
[3749] Fix | Delete
title = '',
[3750] Fix | Delete
charset = '<meta charset="utf-8">\n',
[3751] Fix | Delete
lang = '',
[3752] Fix | Delete
metadata = '';
[3753] Fix | Delete
[3754] Fix | Delete
if (typeof globals.metadata.parsed.doctype !== 'undefined') {
[3755] Fix | Delete
doctypeParsed = '<!DOCTYPE ' + globals.metadata.parsed.doctype + '>\n';
[3756] Fix | Delete
doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
[3757] Fix | Delete
if (doctype === 'html' || doctype === 'html5') {
[3758] Fix | Delete
charset = '<meta charset="utf-8">';
[3759] Fix | Delete
}
[3760] Fix | Delete
}
[3761] Fix | Delete
[3762] Fix | Delete
for (var meta in globals.metadata.parsed) {
[3763] Fix | Delete
if (globals.metadata.parsed.hasOwnProperty(meta)) {
[3764] Fix | Delete
switch (meta.toLowerCase()) {
[3765] Fix | Delete
case 'doctype':
[3766] Fix | Delete
break;
[3767] Fix | Delete
[3768] Fix | Delete
case 'title':
[3769] Fix | Delete
title = '<title>' + globals.metadata.parsed.title + '</title>\n';
[3770] Fix | Delete
break;
[3771] Fix | Delete
[3772] Fix | Delete
case 'charset':
[3773] Fix | Delete
if (doctype === 'html' || doctype === 'html5') {
[3774] Fix | Delete
charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
[3775] Fix | Delete
} else {
[3776] Fix | Delete
charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
[3777] Fix | Delete
}
[3778] Fix | Delete
break;
[3779] Fix | Delete
[3780] Fix | Delete
case 'language':
[3781] Fix | Delete
case 'lang':
[3782] Fix | Delete
lang = ' lang="' + globals.metadata.parsed[meta] + '"';
[3783] Fix | Delete
metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
[3784] Fix | Delete
break;
[3785] Fix | Delete
[3786] Fix | Delete
default:
[3787] Fix | Delete
metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
[3788] Fix | Delete
}
[3789] Fix | Delete
}
[3790] Fix | Delete
}
[3791] Fix | Delete
[3792] Fix | Delete
text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
[3793] Fix | Delete
[3794] Fix | Delete
text = globals.converter._dispatch('completeHTMLDocument.after', text, options, globals);
[3795] Fix | Delete
return text;
[3796] Fix | Delete
});
[3797] Fix | Delete
[3798] Fix | Delete
/**
[3799] Fix | Delete
* Convert all tabs to spaces
[3800] Fix | Delete
*/
[3801] Fix | Delete
showdown.subParser('detab', function (text, options, globals) {
[3802] Fix | Delete
'use strict';
[3803] Fix | Delete
text = globals.converter._dispatch('detab.before', text, options, globals);
[3804] Fix | Delete
[3805] Fix | Delete
// expand first n-1 tabs
[3806] Fix | Delete
text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width
[3807] Fix | Delete
[3808] Fix | Delete
// replace the nth with two sentinels
[3809] Fix | Delete
text = text.replace(/\t/g, '¨A¨B');
[3810] Fix | Delete
[3811] Fix | Delete
// use the sentinel to anchor our regex so it doesn't explode
[3812] Fix | Delete
text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
[3813] Fix | Delete
var leadingText = m1,
[3814] Fix | Delete
numSpaces = 4 - leadingText.length % 4; // g_tab_width
[3815] Fix | Delete
[3816] Fix | Delete
// there *must* be a better way to do this:
[3817] Fix | Delete
for (var i = 0; i < numSpaces; i++) {
[3818] Fix | Delete
leadingText += ' ';
[3819] Fix | Delete
}
[3820] Fix | Delete
[3821] Fix | Delete
return leadingText;
[3822] Fix | Delete
});
[3823] Fix | Delete
[3824] Fix | Delete
// clean up sentinels
[3825] Fix | Delete
text = text.replace(/¨A/g, ' '); // g_tab_width
[3826] Fix | Delete
text = text.replace(/¨B/g, '');
[3827] Fix | Delete
[3828] Fix | Delete
text = globals.converter._dispatch('detab.after', text, options, globals);
[3829] Fix | Delete
return text;
[3830] Fix | Delete
});
[3831] Fix | Delete
[3832] Fix | Delete
showdown.subParser('ellipsis', function (text, options, globals) {
[3833] Fix | Delete
'use strict';
[3834] Fix | Delete
[3835] Fix | Delete
text = globals.converter._dispatch('ellipsis.before', text, options, globals);
[3836] Fix | Delete
[3837] Fix | Delete
text = text.replace(/\.\.\./g, '…');
[3838] Fix | Delete
[3839] Fix | Delete
text = globals.converter._dispatch('ellipsis.after', text, options, globals);
[3840] Fix | Delete
[3841] Fix | Delete
return text;
[3842] Fix | Delete
});
[3843] Fix | Delete
[3844] Fix | Delete
/**
[3845] Fix | Delete
* Turn emoji codes into emojis
[3846] Fix | Delete
*
[3847] Fix | Delete
* List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis
[3848] Fix | Delete
*/
[3849] Fix | Delete
showdown.subParser('emoji', function (text, options, globals) {
[3850] Fix | Delete
'use strict';
[3851] Fix | Delete
[3852] Fix | Delete
if (!options.emoji) {
[3853] Fix | Delete
return text;
[3854] Fix | Delete
}
[3855] Fix | Delete
[3856] Fix | Delete
text = globals.converter._dispatch('emoji.before', text, options, globals);
[3857] Fix | Delete
[3858] Fix | Delete
var emojiRgx = /:([\S]+?):/g;
[3859] Fix | Delete
[3860] Fix | Delete
text = text.replace(emojiRgx, function (wm, emojiCode) {
[3861] Fix | Delete
if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
[3862] Fix | Delete
return showdown.helper.emojis[emojiCode];
[3863] Fix | Delete
}
[3864] Fix | Delete
return wm;
[3865] Fix | Delete
});
[3866] Fix | Delete
[3867] Fix | Delete
text = globals.converter._dispatch('emoji.after', text, options, globals);
[3868] Fix | Delete
[3869] Fix | Delete
return text;
[3870] Fix | Delete
});
[3871] Fix | Delete
[3872] Fix | Delete
/**
[3873] Fix | Delete
* Smart processing for ampersands and angle brackets that need to be encoded.
[3874] Fix | Delete
*/
[3875] Fix | Delete
showdown.subParser('encodeAmpsAndAngles', function (text, options, globals) {
[3876] Fix | Delete
'use strict';
[3877] Fix | Delete
text = globals.converter._dispatch('encodeAmpsAndAngles.before', text, options, globals);
[3878] Fix | Delete
[3879] Fix | Delete
// Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
[3880] Fix | Delete
// http://bumppo.net/projects/amputator/
[3881] Fix | Delete
text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&amp;');
[3882] Fix | Delete
[3883] Fix | Delete
// Encode naked <'s
[3884] Fix | Delete
text = text.replace(/<(?![a-z\/?$!])/gi, '&lt;');
[3885] Fix | Delete
[3886] Fix | Delete
// Encode <
[3887] Fix | Delete
text = text.replace(/</g, '&lt;');
[3888] Fix | Delete
[3889] Fix | Delete
// Encode >
[3890] Fix | Delete
text = text.replace(/>/g, '&gt;');
[3891] Fix | Delete
[3892] Fix | Delete
text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals);
[3893] Fix | Delete
return text;
[3894] Fix | Delete
});
[3895] Fix | Delete
[3896] Fix | Delete
/**
[3897] Fix | Delete
* Returns the string, with after processing the following backslash escape sequences.
[3898] Fix | Delete
*
[3899] Fix | Delete
* attacklab: The polite way to do this is with the new escapeCharacters() function:
[3900] Fix | Delete
*
[3901] Fix | Delete
* text = escapeCharacters(text,"\\",true);
[3902] Fix | Delete
* text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
[3903] Fix | Delete
*
[3904] Fix | Delete
* ...but we're sidestepping its use of the (slow) RegExp constructor
[3905] Fix | Delete
* as an optimization for Firefox. This function gets called a LOT.
[3906] Fix | Delete
*/
[3907] Fix | Delete
showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
[3908] Fix | Delete
'use strict';
[3909] Fix | Delete
text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
[3910] Fix | Delete
[3911] Fix | Delete
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
[3912] Fix | Delete
text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
[3913] Fix | Delete
[3914] Fix | Delete
text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
[3915] Fix | Delete
return text;
[3916] Fix | Delete
});
[3917] Fix | Delete
[3918] Fix | Delete
/**
[3919] Fix | Delete
* Encode/escape certain characters inside Markdown code runs.
[3920] Fix | Delete
* The point is that in code, these characters are literals,
[3921] Fix | Delete
* and lose their special Markdown meanings.
[3922] Fix | Delete
*/
[3923] Fix | Delete
showdown.subParser('encodeCode', function (text, options, globals) {
[3924] Fix | Delete
'use strict';
[3925] Fix | Delete
[3926] Fix | Delete
text = globals.converter._dispatch('encodeCode.before', text, options, globals);
[3927] Fix | Delete
[3928] Fix | Delete
// Encode all ampersands; HTML entities are not
[3929] Fix | Delete
// entities within a Markdown code span.
[3930] Fix | Delete
text = text
[3931] Fix | Delete
.replace(/&/g, '&amp;')
[3932] Fix | Delete
// Do the angle bracket song and dance:
[3933] Fix | Delete
.replace(/</g, '&lt;')
[3934] Fix | Delete
.replace(/>/g, '&gt;')
[3935] Fix | Delete
// Now, escape characters that are magic in Markdown:
[3936] Fix | Delete
.replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
[3937] Fix | Delete
[3938] Fix | Delete
text = globals.converter._dispatch('encodeCode.after', text, options, globals);
[3939] Fix | Delete
return text;
[3940] Fix | Delete
});
[3941] Fix | Delete
[3942] Fix | Delete
/**
[3943] Fix | Delete
* Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
[3944] Fix | Delete
* don't conflict with their use in Markdown for code, italics and strong.
[3945] Fix | Delete
*/
[3946] Fix | Delete
showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
[3947] Fix | Delete
'use strict';
[3948] Fix | Delete
text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.before', text, options, globals);
[3949] Fix | Delete
[3950] Fix | Delete
// Build a regex to find HTML tags.
[3951] Fix | Delete
var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
[3952] Fix | Delete
comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
[3953] Fix | Delete
[3954] Fix | Delete
text = text.replace(tags, function (wholeMatch) {
[3955] Fix | Delete
return wholeMatch
[3956] Fix | Delete
.replace(/(.)<\/?code>(?=.)/g, '$1`')
[3957] Fix | Delete
.replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
[3958] Fix | Delete
});
[3959] Fix | Delete
[3960] Fix | Delete
text = text.replace(comments, function (wholeMatch) {
[3961] Fix | Delete
return wholeMatch
[3962] Fix | Delete
.replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
[3963] Fix | Delete
});
[3964] Fix | Delete
[3965] Fix | Delete
text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
[3966] Fix | Delete
return text;
[3967] Fix | Delete
});
[3968] Fix | Delete
[3969] Fix | Delete
/**
[3970] Fix | Delete
* Handle github codeblocks prior to running HashHTML so that
[3971] Fix | Delete
* HTML contained within the codeblock gets escaped properly
[3972] Fix | Delete
* Example:
[3973] Fix | Delete
* ```ruby
[3974] Fix | Delete
* def hello_world(x)
[3975] Fix | Delete
* puts "Hello, #{x}"
[3976] Fix | Delete
* end
[3977] Fix | Delete
* ```
[3978] Fix | Delete
*/
[3979] Fix | Delete
showdown.subParser('githubCodeBlocks', function (text, options, globals) {
[3980] Fix | Delete
'use strict';
[3981] Fix | Delete
[3982] Fix | Delete
// early exit if option is not enabled
[3983] Fix | Delete
if (!options.ghCodeBlocks) {
[3984] Fix | Delete
return text;
[3985] Fix | Delete
}
[3986] Fix | Delete
[3987] Fix | Delete
text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals);
[3988] Fix | Delete
[3989] Fix | Delete
text += '¨0';
[3990] Fix | Delete
[3991] Fix | Delete
text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
[3992] Fix | Delete
var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
[3993] Fix | Delete
[3994] Fix | Delete
// First parse the github code block
[3995] Fix | Delete
codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
[3996] Fix | Delete
codeblock = showdown.subParser('detab')(codeblock, options, globals);
[3997] Fix | Delete
codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
[3998] Fix | Delete
codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
[3999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function