JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 114765
  • Score
    100M100P100Q148289F
  • License

Markdown template helper. Uses remarkable to render markdown in templates. Should work with Handlebars, Lo-Dash or any template engine that supports helper functions.

Package Exports

  • helper-markdown

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (helper-markdown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

helper-markdown NPM version

Markdown template helper. Uses remarkable to render markdown in templates. Should work with Handlebars, Lo-Dash or any template engine that supports helper functions.

Usage examples

With Handlebars:

<div>
{{#markdown}}
# Heading

> this is markdown

foo bar baz
{{/markdown}}
</div>

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

Register the helper

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

template

Register the helper for use with any template engine

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

assemble

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

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

verb

Register the helper for use with verb:

var verb = require('verb');
verb.helper('markdown', require('helper-markdown'));

handlebars

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

Lo-Dash or underscore

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'

Run tests

npm test

Contributing

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.

Author

Jon Schlinkert

License

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.