Front matter parsing middleware based on gray-matter, providing a callback-oriented API for parsing YAML-like front matter from strings or file objects. Version 1.6.4 is the latest stable release, with no major updates since 2019. It supports both async (parse) and sync (parseSync) methods, and is designed for use with build tools like assemble, verb, or generate. Unlike direct gray-matter usage, this package integrates via middleware conventions, but it is slow, unmaintained, and lacks TypeScript definitions.
npm install parser-front-matterVerified import paths — ran on the pinned version, not inferred.
Shows async and sync front matter parsing from string and object, with error handling.
Consider using gray-matter directly or a maintained alternative.
Use dynamic import() or CommonJS require() for compatibility.
Wrap in a promise: new Promise((resolve, reject) => parser.parse(str, (err, file) => err ? reject(err) : resolve(file))).
Run npm install parser-front-matter --save
Use import parser from 'parser-front-matter' then parser.parse() or import { parse } from 'parser-front-matter'.Run npm install gray-matter