Markdown template helper. Uses remarkable to render markdown in templates. Should work with Handlebars, Lo-Dash or any template engine that supports helper functions.
With Handlebars:
Results in:
<h1>Heading</h1>
<blockquote>
<p>this is markdown</p>
</blockquote>
<p>foo bar baz</p>
Install with npm
npm i helper-markdown --save
This should work with any engine, here are a few examples
Register the helper for use with any template engine
template.helper('markdown', require('helper-markdown'));
To register the helper for use with assemble v0.6.x:
assemble.helper('markdown', require('helper-markdown'));
Register the helper for use with verb:
var verb = require('verb');
verb.helper('markdown', require('helper-markdown'));
var handlebars = require('handlebars');
handlebars.registerHelper('markdown', require('helper-markdown'));
var markdown = require('helper-markdown');
// as a mixin
_.mixin({markdown: markdown});
_.template('<%= _.markdown("# heading") %>', {});
//=> '<h1>heading</h1>\n'
// passed on the context
_.template('<%= markdown("# heading") %>', {markdown: markdown});
//=> '<h1>heading</h1>\n'
// as an import
var settings = {imports: {markdown: markdown}};
_.template('<%= markdown("# heading") %>', {}, settings);
//=> '<h1>heading</h1>\n'
npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
To request or contribute a helper to the github.com/helpers org, please read this contributing guide to get started.
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on December 11, 2014. To update, run npm i -g verb && verb
.