Comments (4)
Definitely thought it was sweet when I saw that parsers (and delimiters) were able to be swapped out.
As for what to bundle, I assume you're talking about keeping the yaml
parser regardless? Honestly not sure. The js
and coffee
ones seem a bit opinionated? But built-in json
, yaml
, toml
seems nice for people. Although I'll only ever use yaml
like you said. Either just yaml
or yaml,json,toml
seems right. I guess someone could ask for an xml
one, at which point it might be nicer to just have an opinion of only yaml
.
Side note: I thought regular JSON was "correct" YAML as well, so technically JSON parsing it automatically handled? I guess the only different is the opening and closing {}
. Even the json
one might be slightly opinionated in that case, not sure.
from gray-matter.
Definitely thought it was sweet when I saw that parsers (and delimiters) were able to be swapped out.
thanks! yeah my inner nerd is resisting taking them out...
I assume you're talking about keeping the yaml parser regardless?
yes, definitely.
The js and coffee ones seem a bit opinionated?
noted. I really wasn't sure what to do when I implemented those. it's funny, I've never even used the coffee parser in project (because I forget about it), but I probably should, when I was writing the tests it was pretty fun defining helpers in the front matter and then using them in the same file.
But built-in json, yaml, toml seems nice for people.
also noted. that seems like a good mix.
thought regular JSON was "correct" YAML as well
but I got all excited about being able to let people use JSON lol.
thanks for the feedback Ian. @doowb any thoughts?
from gray-matter.
You're already only requiring js-yaml
if it's used and also allowing passing in a parser function opts.fn
so I think that should be fine, right?
var myParser = require('my-parser');
var parsed = matter(str, { parser: myParser });
from gray-matter.
closing since gray-matter was refactored. custom engines are now supported via options (parsing and stringifying), and some sensible defaults are still included.
from gray-matter.
Related Issues (20)
- Max Integer Size HOT 1
- apostrophe in frontmatter HOT 2
- Can't parse datetime format
- ReferenceError: Buffer is not defined HOT 6
- typescript issues - is this package deprecated?
- Can't get values of double-nested entries
- Passing environment variable to the yaml file header HOT 2
- (Request) Any way to generate "square bracket" arrays rather than lists? HOT 1
- Add support for async excerpt functions? HOT 2
- Some kind of unwanted caching behaviour?
- `file.isEmpty` is not documented in typings
- gray-matter seems to be broken in Next 13 HOT 2
- Add Superscript Support
- Image for sponsorships
- android app issues
- Invalid front-matter should not be cached
- adding colon inside string breaks gray-matter parsing HOT 1
- Add Generic Data Typing for matter Frontmatter Parsing HOT 4
- Expose `YAMLException` from `js-yaml`
- The `excerpt` function option should be a function that returns a string, but it isn't HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gray-matter.