2015-01-16 05:21:33 +08:00
|
|
|
/**
|
|
|
|
* Returns the string, with after processing the following backslash escape sequences.
|
|
|
|
*
|
|
|
|
* attacklab: The polite way to do this is with the new escapeCharacters() function:
|
|
|
|
*
|
|
|
|
* text = escapeCharacters(text,"\\",true);
|
|
|
|
* text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
|
|
|
|
*
|
|
|
|
* ...but we're sidestepping its use of the (slow) RegExp constructor
|
|
|
|
* as an optimization for Firefox. This function gets called a LOT.
|
|
|
|
*/
|
2017-01-30 03:28:30 +08:00
|
|
|
showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
|
2015-01-19 19:37:21 +08:00
|
|
|
'use strict';
|
2017-01-30 03:28:30 +08:00
|
|
|
text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
|
|
|
|
|
2015-01-19 19:37:21 +08:00
|
|
|
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
|
2017-02-21 22:13:12 +08:00
|
|
|
text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
|
2017-01-30 03:28:30 +08:00
|
|
|
|
|
|
|
text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
|
2015-01-19 19:37:21 +08:00
|
|
|
return text;
|
2015-01-16 05:21:33 +08:00
|
|
|
});
|