-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch back to gray-matter
for front-matter parsing.
#601
Conversation
afd871c
to
be05569
Compare
gray-matter
for front-matter parsing.gray-matter
for front-matter parsing.
gray-matter
for front-matter parsing.gray-matter
for front-matter parsing.
be05569
to
362ec92
Compare
gray-matter
for front-matter parsing.gray-matter
for front-matter parsing.
gray-matter
for front-matter parsing.gray-matter
for front-matter parsing.
gray-matter
for front-matter parsing.gray-matter
for front-matter parsing.
43d31bf
to
ed62497
Compare
toml: tomlEng.parse.bind(tomlEng), | ||
json: (input) => { | ||
let JSONinput = input.trim(); | ||
// Fix JSON if leading and trailing brackets were trimmed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would brackets be trimmed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delimiters always get trimmed. For stuff like YAML where the delims are ---
and not actually part of the code that is helpful. But with JSON, the delimiters {
and }
get trimmed, but they actually need to be in there for the parser. With preliminaries
they did this too, here: preliminaries/index.js#L376-L379
We can't just add them all the time, though, we have to if
-check first, because they could have wrapped the whole thing in a ---json
delimiter, in which case the brackets wouldn't get trimmed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also see the difference in the tests:
https://github.com/netlify/netlify-cms/blob/3195f30b8d174b4820ef65d07d64ded336477af8/src/formats/__tests__/frontmatter.spec.js#L69
vs
https://github.com/netlify/netlify-cms/blob/3195f30b8d174b4820ef65d07d64ded336477af8/src/formats/__tests__/frontmatter.spec.js#L81
ed62497
to
1ebbc05
Compare
This upgrade allow `gray-matter` to work in browsers as well.
1ebbc05
to
86c4987
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Summary
Switch from
preliminaries
back togray-matter
for front-matter parsing.This is currently based on #592, and will be rebased after that one is merged.done- Test plan
Passes current front-matter tests.
- Description for the changelog
Switch back to
gray-matter
for front-matter parsing.