Search results
Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and . Latest version: 4.0.3, last published: 3 years ago.
30 iun. 2023 · 1. After migrating an app from Next 12 to Next 13, I found that gray-matter broke down. The same code worked fine, in the previous version of Next.js, i.e., Next 12. Prior to migration, the following code worked fine: const source = fs.readFileSync(sourcePath); const {content, data} = matter(source); It returned the desired result.
Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and many other projects.
What does this do? Run this example. Converts a string with front-matter, like this: --- title: Hello slug: home --- . < h1 >Hello world!</ h1 > Into an object like this: { content: '<h1>Hello world!</h1>', data: { title: 'Hello', slug: 'home' } } Why use gray-matter? simple: main function takes a string and returns an object.
api documentation for gray-matter (v2.1.1) Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and.
24 mai 2020 · For me, the error was occurring because the NJK prettier plugin in VS Code converted valid syntax into single line while saving. I disabled the plugin for now. However, I am looking for a better solution.
gray-matter. Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and many other projects.