verb
Version:
A project without documentation is like a project that doesn't exist. Verb solves this by making it dead simple to generate docs, using simple markdown templates, with zero configuration required.
20 lines (16 loc) • 476 B
JavaScript
/**
* 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}
*/
module.exports = function(verb) {
var content = verb.page.content;
function convert(str) {
return str.replace(/<!--\s*([\S]+)\(([\S]+)\)\s*-->/g, '{%= $1($2) %}');
}
verb.page.content = convert(content);
};