mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
14 lines
276 B
JavaScript
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);
|
||
|
}
|
||
|
});
|