showdown/src/subParsers/runExtension.js

14 lines
276 B
JavaScript
Raw Normal View History

2015-03-02 02:15:32 +08:00
/**
* 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);
}
});