gray-matter icon indicating copy to clipboard operation
gray-matter copied to clipboard

`.matter` is not cached properly

Open nwhitehead opened this issue 5 months ago • 0 comments

The .matter result property behaves weirdly with caching.

Example:

Welcome to Node.js v21.7.3.
Type ".help" for more information.
> let matter = require('gray-matter');
undefined
> matter('---\ntitle: Title\n---').matter
'\ntitle: Title'
> matter('---\ntitle: Title\n---').matter
undefined

I'm using the .matter property to help map back to precise original source lines (e.g. click in the rendered Markdown to open text editor to right place in source markdown). My workaround right now is to first call matter.clearCache() to always get the .matter property set correctly.

nwhitehead avatar Sep 23 '24 16:09 nwhitehead