blob: 483b18494e205b7097026b3c396caa1b29315be6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
var _ = require('lodash');
module.exports = function(markdown, includer) {
// Memoized include function (to cache lookups)
var _include = _.memoize(includer);
return markdown.replace(/{{([\s\S]+?)}}/g, function(match, key) {
// If fails leave content as is
key = key.trim();
return _include(key) || match;
});
};
|