Gray Matter screenshot

Gray Matter

Author Avatar Theme by Jonschlinkert
Updated: 13 Jul 2023
4135 Stars

Smarter YAML front matter parser, used by metalsmith, Gatsby, Netlify, Assemble, mapbox-gl, phenomic, vuejs vitepress, TinaCMS, Shopify Polaris, Ant Design, Astro, hashicorp, garden, slidev, saber, sourcegraph, and many others. Simple to use, and battle tested. Parses YAML by default but can als...

Categories

Overview:

Gray-matter is a versatile NPM package designed to parse front-matter from a string or file. It offers fast, reliable, and easy-to-use capabilities for extracting metadata in formats such as YAML, JSON, TOML, or Coffee Front-Matter. This package, created by Jon Schlinkert, is widely used in projects like metalsmith, assemble, verb, and many others.

Features:

  • Fast and Reliable: Provides efficient parsing of front-matter from strings or files.
  • Supports Multiple Formats: Capable of parsing YAML, JSON, TOML, or Coffee Front-Matter.
  • Custom Delimiters: Allows setting custom delimiters for more flexibility.
  • Used by Major Projects: Trusted and utilized by popular projects like metalsmith, assemble, and verb.
  • Error-Handling: Better at catching and handling edge cases than regex-based parsers.
  • Flexible and Extensible: Can support additional languages and custom engines for front-matter parsing.

Installation:

To install Gray-matter using npm, use the following command:

npm install gray-matter

Please refer to the changelog for any breaking changes that may have been introduced in version 3.0.

Summary:

Gray-matter is a powerful tool for extracting front-matter from strings or files with support for various formats and custom delimiters. Its speed, reliability, and flexibility make it a preferred choice for parsing metadata in projects requiring accurate and efficient handling of front-matter. With ongoing support and maintenance from the community and the author, Jon Schlinkert, Gray-matter continues to be a valuable asset for developers.