mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
13 lines
355 B
JavaScript
13 lines
355 B
JavaScript
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;
|
|
});
|
|
};
|