verb
Version:
Verb makes it easy to build project documentation using simple markdown templates, with zero configuration required.
20 lines (16 loc) • 495 B
JavaScript
module.exports = function(verb) {
var content = verb.page.content;
/**
* Convert HTML comments to valid Lo-Dash
* templates This example only works with
* "include" syntax, e.g. `{%= foo('something') %}`,
* not regular variables, e.g. `{% foo %}`
*
* @param {String} str Source content
* @return {String}
*/
function convert(str) {
return str.replace(/<!--\s*([\S]+)\(([\S]+)\)\s*-->/g, '{%= $1($2) %}');
};
verb.page.content = convert(content);
};