Template helper for parsing front matter and passing the data to templates as context.
npm
Install withnpm i helper-front-matter --save
Usage
First, let's register another cutomer helper for this example:
var fs = ;var handlebars = ;var matter = handlebars;
Register the helper
// this is our helperhandlebars; // these are extra helpers we'll use for exampleshandlebars;handlebars;
Create some templates
Given you have a file, abc.hbs
, with the following contents:
---title: ABCfoo: bar--- ## This is {{title}} > this is a blockquote
Use the helpers
Used with the markdown
helper as a block helper:
{{#markdown}}# Heading{{{matter (read "fixtures/abc.hbs")}}}{{/markdown}}
Renders to:
HeadingThis is ABCthis is a blockquote
Used with the markdown
helper as an inline helper:
{{{markdown (matter (read "fixtures/abc.hbs"))}}}
Renders to:
This is ABCthis is a blockquote
Running tests
Install dev dependencies:
npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on April 09, 2015.