showdown/src/subParsers/runExtension.js
2015-03-01 18:15:32 +00:00

14 lines
276 B
JavaScript

/**
* Run language extensions
*/
showdown.subParser('runExtension', function (ext, text) {
'use strict';
if (ext.regex) {
var re = new RegExp(ext.regex, 'g');
return text.replace(re, ext.replace);
} else if (ext.filter) {
return ext.filter(text);
}
});