jonschlinkert / gray-matter

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 also parse JSON Front Matter, Coffee Front Matter, TOML Front Matter, and has support for custom parsers. Please follow gray-matter's author: https://github.com/jonschlinkert
https://github.com/jonschlinkert
MIT License
3.97k stars 138 forks source link

No mention of cache #106

Open buckle2000 opened 4 years ago

buckle2000 commented 4 years ago

There is a part of my code that looks like this:

doc = matter()
doc.content = render(doc.content)

Took awhile to figure out it returns the same object. I don't think gray-matter should keep the object it returns.

jdedwards3 commented 3 years ago

this thread helped: https://github.com/jonschlinkert/gray-matter/issues/43#issuecomment-318258919

Passing in empty options object disables caching. This is especially noticeable with many test files containing the same content.

Would, minimally, a PR for the docs be helpful, or a change to make cache keys unique?

SystemParadox commented 3 years ago

I just lost several hours due to this. If there is any caching at all it should be clearly stated in the readme.