mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
22 lines
756 B
JavaScript
22 lines
756 B
JavaScript
|
/**
|
||
|
* Created by Estevao on 11-01-2015.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* 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.
|
||
|
*/
|
||
|
showdown.subParser('encodeBackslashEscapes', function (text) {
|
||
|
'use strict';
|
||
|
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
|
||
|
text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g, showdown.helper.escapeCharactersCallback);
|
||
|
return text;
|
||
|
});
|