JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 36409
  • Score
    100M100P100Q148683F

Front matter parser that uses gray-matter and bits of real panther, so you know it's good.

Package Exports

  • parser-front-matter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parser-front-matter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

parser-front-matter NPM version

Front matter parser that uses gray-matter and bits of real panther, so you know it's good.

This is kind of like a consolidate.js engine, accept it's not an engine, it's a parser. Works with Assemble, verb, express.js, parser-cache, or any application with similar conventions.

Install with npm

npm i parser-front-matter --save

Usage

var parser = require('parser-front-matter');

API

.parse

Parse the given file into a normalized file object and callback next(err, file). Options are passed to gray-matter, and if options has a locals property, it will be merged with the data property on the normalized file object.

  • file {String|Object}: The object or string to parse.
  • options {Object|Function}: or next callback function.
  • next {Function}: callback function.

Normalized file objects should have the following properties:

  • path The source file path, if provided
  • data: metadata, from yaml front matter and/or locals
  • content: the content of a file, excluding front-matter
  • orig: the original content of a file, including front-matter

.parseSync

  • file {String|Object}: The object or string to parse.
  • options {Object}: to pass to gray-matter.

Parse the given file and return a normalized file object, with data, content, path and orig properties.

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on February 19, 2015.