.matter is not cached properly #174

Open
opened 2024-09-23 16:57:26 +00:00 by amberwhitehead · 0 comments
amberwhitehead commented 2024-09-23 16:57:26 +00:00 (Migrated from github.com)

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.

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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rtlabs-llm-agents/gms-gray-matter#174
No description provided.