gray-matter
Backend / API library · Free
A front matter parser for Markdown and other documents: it extracts metadata for content sites and pipelines.
Also known as: jonschlinkert/gray-matter; graymatter; gray-matter-parser

What you can use for free
Code and local use under MIT.
Paid features and costs
Computing resources, self-hosting, and external services are paid for separately if used.
Access and limitations
Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.
Use cases
- Extract metadata from Markdown documents
- Separate metadata and content and pass them to rendering or a content pipeline
Example workflow
A possible workflow; this is not a report of hands-on testing.
Extract metadata from Markdown documents.
Before you start
- A data contract or HTTP workflow.
- A project with a supported runtime.
Steps
- Prepare a document with front matter and define metadata fields.
- Separate metadata and content and pass them to rendering or a content pipeline.
- Add error handling and an integration check of the result.
Check your result
- Invalid and missing data are handled predictably.
- Types and the actual response agree; errors are not hidden.
Choosing gray-matter
Extract metadata from Markdown documents
Choose this when
- Extract metadata from Markdown documents
- Separate metadata and content and pass them to rendering or a content pipeline
Things to consider
- Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
- Terms of use: MIT for the code; dependencies have separate licenses.
- Parsing support does not imply built-in reverse serialization for a format; a corresponding engine is needed.
Frequently asked questions
What can you use for free in gray-matter?
Code and local use under MIT.
What additional costs might arise with gray-matter?
Computing resources, self-hosting, and external services are paid for separately if used.
What terms of use matter for gray-matter?
MIT for the code; dependencies have separate licenses.
How do you get started with gray-matter?
Prepare a document with front matter and define metadata fields. Separate metadata and content and pass them to rendering or a content pipeline. Add error handling and an integration check of the result.
Can I change the front matter format and save it back?
The parser separates data, content, and excerpt; YAML is the default, while custom formats use engines and delimiters. stringify supports YAML/JSON by default; another format requires an engine with stringify. matter.read reads a file synchronously.
License
MIT for the code; dependencies have separate licenses.
MIT — permissive license
You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.
License termsTechnologies and topics
- gray-matter
- API
- Development