Skip to content
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

feat: support json front matter #142

Closed
4 tasks
slathrop opened this issue Apr 18, 2018 · 3 comments
Closed
4 tasks

feat: support json front matter #142

slathrop opened this issue Apr 18, 2018 · 3 comments

Comments

@slathrop
Copy link
Contributor

slathrop commented Apr 18, 2018

Similar to other SSGs (Hugo, etc.), add support in VuePress for JSON front matter (in addition to YAML and TOML [#141]).

  • Select or write package equivalent to yaml-front-matter
  • Add reference to /lib/prepare.js
  • Complete Implementation
  • Complete Testing
@yeedle
Copy link

yeedle commented Apr 18, 2018

Objects seem to work, am I missing something? The following works for me

---
...
foo: { bar: "baz" }
...
---
{{ $page.frontmatter.foo.bar }}

resolves to "baz" for me.

@slathrop
Copy link
Contributor Author

@yeedle Thanks. Yes indeedy YAML syntax is mostly a superset of JSON. But, for example, if you remove the space after a colon (e.g., bar:"baz") YAML parsers generally won't like that. More info here.

JSON support in front matter also means that you'd see opening and closing curly braces { } instead of --- for YAML (or +++ for TOML).

It's just a matter of "playing nice" and working with JSON without friction so-to-speak for those coming from other SSGs that directly support JSON, YAML, and TOML.

@yyx990803
Copy link
Member

Closing and tracking together in #141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants