showdown/src/subParsers/runExtension.js
greenkeeper[bot] b5e46fdb8d Update dependencies to enable Greenkeeper 🌴 (#335)
adapt code to updated dependencies
2017-01-31 05:46:25 +00:00

21 lines
460 B
JavaScript

/**
* Run extension
*/
showdown.subParser('runExtension', function (ext, text, options, globals) {
'use strict';
if (ext.filter) {
text = ext.filter(text, globals.converter, options);
} else if (ext.regex) {
// TODO remove this when old extension loading mechanism is deprecated
var re = ext.regex;
if (!(re instanceof RegExp)) {
re = new RegExp(re, 'g');
}
text = text.replace(re, ext.replace);
}
return text;
});