Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Utilities for extracting Front Matter from source files.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
docs
test 0.1.2 remove logic until we add more formats. it breaks too easy.
.editorconfig initial setup
.gitattributes initial setup
.gitignore update tests and example files
.jshintrc initial setup
.travis.yml initial setup
AUTHORS adds grunt-readme
CHANGELOG adds grunt-readme
CONTRIBUTING.md initial setup
Gruntfile.js 0.1.2 remove logic until we add more formats. it breaks too easy.
LICENSE-MIT initial setup
README.md update docs
bower.json 0.1.2 remove logic until we add more formats. it breaks too easy.
index.js move to root
package.json 0.1.2 remove logic until we add more formats. it breaks too easy.

README.md

assemble-front-matter NPM version Build Status

Utilities for extracting front matter from source files.

Visit Assemble's documentation for many more examples and pointers on getting started.

Getting Started

npm install assemble-front-matter --save

and use it as follows:

var yfm = require('assemble-front-matter');

Methods

extract

Extract YAML front matter and content from files.

var raw = yfm.extract("./file.hbs", opts);

Parameters:

  • String: The file to read.
  • Object: The options object to pass to js-yaml

Returns:

Object with three properties

{
 "context": {}         // Object. YAML front matter returned as a JSON object.
 "content": ""         // String. File content, stripped of YAML front matter
 "originalContent": "" // String. Both content and YAML front matter.
}

context

Return YAML front matter as a JSON object.

var data = yfm.extract("./file.hbs").context;

Alias:

var data = yfm.extractJSON("./file.hbs");

content

Return the content of a file, with YAML front matter removed.

var content = yfm.extract("./file.hbs").content;

Alias:

var data = yfm.stripYFM("./file.hbs");

Release History

  • 2013-09-22   v0.1.2   Adds grunt-readme and grunt-pkg-sync
  • 2013-09-02   v0.1.1   Updates tests and example files
  • 2013-08-11   v0.1.0   Initial setup

Author

License

Copyright (c) 2013 Brian Woodward, contributors. Released under the MIT license


This file was generated on Mon Sep 02 2013 09:44:51.

Something went wrong with that request. Please try again.