
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
helper-front-matter
Advanced tools
Template helper for parsing front matter and passing the data to templates as context/
Template helper for parsing front matter and passing the data to templates as context.
npm i helper-front-matter --save
First, let's register another cutomer helper for this example:
var fs = require('fs');
var handlebars = require('handlebars');
var matter = require('helper-front-matter')(handlebars);
// 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');
});
Given you have a file, abc.hbs, with the following contents:
---
title: ABC
foo: bar
---
## This is {{title}}
> this is a blockquote
Used with the markdown helper as a block helper:
{{#markdown}}
# Heading
{{{matter (read "fixtures/abc.hbs")}}}
{{/markdown}}
Renders to:
<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:
{{{markdown (matter (read "fixtures/abc.hbs"))}}}
Renders to:
<h2>This is ABC</h2>
<blockquote>
<p>this is a blockquote</p>
</blockquote>
Install dev dependencies:
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on April 09, 2015.
FAQs
Template helper for parsing front matter and passing the data to templates as context/
We found that helper-front-matter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.