# helper-front-matter

> Template helper for parsing front matter and passing the data to templates as context/

Latest version **0.1.0** (published 2015-04-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install helper-front-matter
pnpm add helper-front-matter
yarn add helper-front-matter
bun add helper-front-matter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-04-10 |
| First published | 2015-04-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | context, data, front, front-matter, gray, gray-matter, handlebars, helper, markdown, matter, parse, templates |

## Links

- npm: https://www.npmjs.com/package/helper-front-matter
- Repository: https://github.com/helpers/helper-front-matter
- Issues: https://github.com/helpers/helper-front-matter/issues
- npm.io page: https://npm.io/package/helper-front-matter

## Dependencies (2)

- [gray-matter](https://npm.io/package/gray-matter.md) ^2.0.0
- [extend-shallow](https://npm.io/package/extend-shallow.md) ^1.1.2

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-04-10

## README

# helper-front-matter [![NPM version](https://badge.fury.io/js/helper-front-matter.svg)](http://badge.fury.io/js/helper-front-matter)

> Template helper for parsing front matter and passing the data to templates as context.

## Install with [npm](npmjs.org)

```bash
npm i helper-front-matter --save
```

## Usage

First, let's register another cutomer helper for this example:

```js
var fs = require('fs');
var handlebars = require('handlebars');
var matter = require('helper-front-matter')(handlebars);
```

### Register the helper

```js
// this is our helper
handlebars.registerHelper('matter', matter(handlebars));

// these are extra helpers we'll use for examples
handlebars.registerHelper('markdown', require('helper-markdown'));
handlebars.registerHelper('read', function (fp) {
  return fs.readFileSync(fp, 'utf8');
});
```

### Create some templates

Given you have a file, `abc.hbs`, with the following contents:

```handlebars
---
title: ABC
foo: bar
---

## This is {{title}}

> this is a blockquote
```

### Use the helpers

Used with the `markdown` helper as a block helper:

```handlebars
{{#markdown}}
# Heading
{{{matter (read "fixtures/abc.hbs")}}}
{{/markdown}}
```

Renders to:

```html
<h1>Heading</h1>
<h2>This is ABC</h2>
<blockquote>
<p>this is a blockquote</p>
</blockquote>
```

Used with the `markdown` helper as an inline helper:

```handlebars
{{{markdown (matter (read "fixtures/abc.hbs"))}}}
```

Renders to:

```html
<h2>This is ABC</h2>
<blockquote>
<p>this is a blockquote</p>
</blockquote>
```


## Running tests
Install dev dependencies:

```bash
npm i -d && npm test
```

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/helpers/helper-front-matter/issues)

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 

## License
Copyright (c) 2015 Jon Schlinkert  
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 09, 2015._

---
_Source: https://npm.io/package/helper-front-matter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
