JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 122098
  • Score
    100M100P100Q151905F
  • 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-md

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-md) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

helper-md 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:

{{md "posts/foo.md"}}

Results in something like:

<h1>Heading</h1>
<blockquote>
<p>this is markdown</p>
</blockquote>
<p>foo bar baz</p>

Install with npm

npm i helper-md --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('md', require('helper-md'));

assemble

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

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

verb

Register the helper for use with verb:

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

handlebars

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

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'

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 12, 2014. To update, run npm i -g verb && verb.