Pass Data in matter() Option #110

Open
opened 2020-06-30 05:54:03 +00:00 by pxwee5 · 1 comment
pxwee5 commented 2020-06-30 05:54:03 +00:00 (Migrated from github.com)

Is there a way to pass global data or other kinds of data e.g. required() data in an object into the option field? That way we can just reference it like

---
images:
  small: {{image.mobile.src}}
  medium: {{image.tablet.src}}
  large: {{image.desktop.src}}
---

The object is supplied in another javascript code with

const image = require('hello.jpg?resize=500,100,1500')
Is there a way to pass global data or other kinds of data e.g. required() data in an object into the option field? That way we can just reference it like ``` --- images: small: {{image.mobile.src}} medium: {{image.tablet.src}} large: {{image.desktop.src}} --- ``` The object is supplied in another javascript code with ``` const image = require('hello.jpg?resize=500,100,1500') ```
doowb commented 2020-06-30 13:47:31 +00:00 (Migrated from github.com)

This package (gray-matter) does not do anything with those values in the front matter. It just parses the front matter from the contents passed in and turns it into an object. This means your .data property will look like this:

{
  images: {
    small: '{{image.mobile.src}}',
    medium: '{{image.tablet.src}}',
    large: '{{image.desktop.src}}'
}

You can use something else, like expand to ... expand those values.

This package (`gray-matter`) does not do anything with those values in the front matter. It just parses the front matter from the contents passed in and turns it into an object. This means your `.data` property will look like this: ```js { images: { small: '{{image.mobile.src}}', medium: '{{image.tablet.src}}', large: '{{image.desktop.src}}' } ``` You can use something else, like [expand](https://github.com/jonschlinkert/expand) to ... expand those values.
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#110
No description provided.