0.3.0 • Published 11 months ago

white-matter v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

white-matter

white-matter is a YAML front matter parser which is an alternative to gray-matter and includes minimal functionality.

Instead of throwing an error like gray-matter when a YAML syntax error occurs in the js-yaml used internally, this library sets undefind to data and returns content (the Markdown part) as usual.

This behavior may be useful in cases where processing must continue even with an invalid front matter format. (e.g. Markdown editor plugins).

Install

npm install white-matter

Usage

The basic usage is the same as for gray-matter, but no advanced options exist now.

import matter from 'white-matter';

console.log(matter('---\ntitle: Front Matter\n---\nThis is content.'));

// -> { content: 'This is content.', data: { title: 'Front Matter' } }

Benchmark

gray-matter x 573,338 ops/sec ±1.34% (84 runs sampled)
white-matter x 795,682,710 ops/sec ±0.56% (86 runs sampled)
Fastest is white-matter

License

MIT

0.3.0

11 months ago

0.2.1

11 months ago

0.2.0

1 year ago

0.1.0

2 years ago