jonschlinkert/gray-matter

Matter instance for global settings. Also, engine.yaml.parse should be optional.

patarapolw opened this issue · 0 comments

It would be nice if I can

import matter from 'gray-matter'
matter.defaults.engines.yaml = {
          stringify: (obj) => yaml.safeDump(obj, { skipInvalid: true }),
          parse: (s) => yaml.safeLoad(s, { schema: yaml.JSON_SCHEMA }),
        }

Actually, I also have one more problem,

matter.stringify(content, {
      ...header, id, date, title, tag,
    }, {
      engines: {
        yaml: {
          stringify: (obj) => yaml.safeDump(obj, { skipInvalid: true }),
          parse: (s) => yaml.safeLoad(s, { schema: yaml.JSON_SCHEMA }),
        },
      },
    })

I cannot omit engine.yaml.parse even if I don't need it.