showdown/src/subParsers/unescapeSpecialChars.js

16 lines
529 B
JavaScript
Raw Normal View History

2015-01-16 05:21:33 +08:00
/**
* Swap back in all the special characters we've hidden.
*/
showdown.subParser('unescapeSpecialChars', function (text, options, globals) {
2015-01-19 19:37:21 +08:00
'use strict';
text = globals.converter._dispatch('unescapeSpecialChars.before', text, options, globals);
2015-01-16 05:21:33 +08:00
text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
2015-01-19 19:37:21 +08:00
var charCodeToReplace = parseInt(m1);
return String.fromCharCode(charCodeToReplace);
});
text = globals.converter._dispatch('unescapeSpecialChars.after', text, options, globals);
2015-01-19 19:37:21 +08:00
return text;
2015-01-16 05:21:33 +08:00
});