Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.28 KB

docs.md

File metadata and controls

57 lines (39 loc) · 1.28 KB

Register the helper

This should work with any engine, here are a few examples

Register the helper for use with any template engine

template.helper('md', require('helper-md'));

To register the helper for use with assemble v0.6.x:

assemble.helper('md', require('helper-md'));

Register the helper for use with verb:

var verb = require('verb');
verb.helper('md', require('helper-md'));
var handlebars = require('handlebars');
handlebars.registerHelper('md', require('helper-md'));

lodash

Should work the same with Lo-Dash or underscore:

var md = require('helper-md');

// as a mixin
_.mixin({md: md});
_.template('<%= _.md("posts/foo.md") %>', {});
//=> '<h1>heading</h1>\n'

// passed on the context
_.template('<%= md("posts/foo.md") %>', {md: md});
//=> '<h1>heading</h1>\n'

// as an import
var settings = {imports: {md: md}};
_.template('<%= md("posts/foo.md") %>', {}, settings);
//=> '<h1>heading</h1>\n'