$ npm install handlebars-helper-md
Convert markdown to HTML. Use wildcard (glob) patterns for files. Like Assemble itself, this helper will automatically determine the correct context to use, or a context may be explicitly passed in as a second parameter.
If you find a bug or have a feature request, please create an issue.
Install with npm:
npm i handlebars-helper-md --save-dev`
Install with bower:
bower install handlebars-helper-md --save-dev`
The easiest way to register the helper with Assemble is to add the module to devDependencies and keywords in your project's package.json:
{
"devDependencies": {
"handlebars-helper-md": "*"
},
"keywords": [
"handlebars-helper-md"
]
}
Alternatively, to register the helper explicitly in the Gruntfile:
grunt.initConfig({
assemble: {
options: {
// the 'handlebars-helper-md' npm module must also be listed in
// devDependencies for assemble to automatically resolve the helper
helpers: ['handlebars-helper-md', 'foo/*.js']
},
files: {
'dist/': ['src/templates/*.hbs']
}
}
});
With the helper registered, you may now begin using it in your templates:
{{md 'foo'}}
assemble: {
options: {
partials: ['test/fixtures/includes/*.md'],
},
files: {
'dest/': ['src/*.{hbs,md}']
}
}
Optionally pass in a context as the second parameter:
{{md 'foo' bar}}
Globbing patterns may also be used:
{{md 'chapter-*' bar}}
assemble: {
options: {
// marked.js options
marked: {
sanitize: true,
// see test/fixtures/render/heading.tmpl
headings: 'anchors.tmpl'
},
partials: ['includes/*.md'],
},
files: {
'dest/': ['src/*.{hbs,md}']
}
}
Like Assemble itself, this helper attempts to automatically determine the correct context to use based on the data supplied, but a context can be explicitly passed as a second parameter.
This is how data is merged into the context, in order of precedence:
{{md 'foo' bar}}, will win over other contexts.options.data with a basename matching the name of the markdown file, e.g {{md 'foo'}} matches foo.jsonthis likely means either YAML front matter of the "inheriting" page, the inheriting layout, block expression, or "parent" helper wrapping this helpergrunt.config.data (e.g. pkg: grunt.file.readJSON('package.json'))Besides the handlebars-helpers library, which contains more than 120 helpers, Here are some related projects you might be interested in from the Assemble core team.
<br> tags to generated HTML. Great for prototyping.<style>...</style> tags of the rendered HTML, but you may alternatively define a destination path using the dest hash option of the helper.Visit assemble.io/plugins for more information about Assemble plugins.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt, and build the documentation with grunt-readme.
Jon Schlinkert
Brian Woodward
Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license
This file was generated by grunt-readme on Wednesday, February 5, 2014.