Skip to content

Nue's simplicity is great! But then why YAML over JSON? #536

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

Open
elimisteve opened this issue Apr 1, 2025 · 7 comments
Open

Nue's simplicity is great! But then why YAML over JSON? #536

elimisteve opened this issue Apr 1, 2025 · 7 comments
Labels
question Further information is requested

Comments

@elimisteve
Copy link
Contributor

Is your feature request or improvement related to a problem?

The problem of complexity, yes! YAML is not like JSON, it's a complexity disaster: https://noyaml.com/ .

Solution you'd like

How about using site.json instead of site.yaml? Same for blog/blog.yaml, etc; let's use .json files, not .yaml.

Alternatives you've considered

.toml might be a decent choice! It'd be great for simple config, but once you need to nest data structures a bit (like simple-blog's site.yaml does with navigation.header and navigation.footer), it seems like JSON would be a better fit.

Additional context

Seriously, check out https://noyaml.com/ ! FYI the YAML spec is 5-10x the size of the JSON spec. Given the brilliant simplicity of Nue, it deserves so much better than YAML!

@elimisteve elimisteve added improvement new feature New feature or request labels Apr 1, 2025
@nobkd nobkd removed the improvement label Apr 1, 2025
@nobkd
Copy link
Collaborator

nobkd commented Apr 1, 2025

I personally think yaml is much easier to write and read, but that's just my opinion. AFAIK yaml is a superset of json, so you could probably just write json in there, if you wanted to..

@tipiirai
Copy link
Contributor

tipiirai commented Apr 2, 2025

Shortly: YAML is for humans, JSON for machines. And many of the issues listed on your link (like the Norway problem) no longer exist — at least on the js-yaml implementation we use. If something, we could think of implementing our custom YAML parser without any of the listed problems. I feel JSON would make Nue configuration more complex, not simpler.

@tipiirai tipiirai added question Further information is requested and removed new feature New feature or request labels Apr 2, 2025
@tipiirai
Copy link
Contributor

tipiirai commented Apr 2, 2025

I agree that Nue deservers something better than the current YAML specification — particularly because Nue gets unwarranted bad rap because of that choice. For that reason I have seriously thought about writing a YAML parser, which only takes the good parts of it and addresses the issues listed in noyaml.com. Should be quite small/straightforward project. Does anyone want to help here?

@AIABHISHEK
Copy link

I agree that Nue deservers something better than the current YAML specification — particularly because Nue gets unwarranted bad rap because of that choice. For that reason I have seriously thought about writing a YAML parser, which only takes the good parts of it and addresses the issues listed in noyaml.com. Should be quite small/straightforward project. Does anyone want to help here?

I guess that would be best thing would love help

@chan27-2
Copy link

chan27-2 commented Apr 2, 2025

this sounds like a super interesting idea can i jump in too

@elimisteve
Copy link
Contributor Author

@AIABHISHEK @chan27-2 I asked Claude to write a parser to parse the specific subset of YAML it seems Nue uses. Here's what it came up with: https://claude.ai/share/b7e555e6-1628-4feb-8634-6cd6364aa2ae

@tipiirai
Copy link
Contributor

tipiirai commented Apr 7, 2025

Glad to see excitement around this!

For the syntax I primarly wish flexible string handling:

  1. Never require string values to be quoted. You could write my_string: Foo : Bar "baz" and 'whatever' without issues
  2. Same with any nested items. globals: [ @global ] would not need quotes

The above would remove all my personal glitches with YAML. I don't really have any other complaitnts about YAML — I actually like it. For the project itself, I'd like to see minimalistic source code. Claude gave a a good starting point, but there's always room for improvement. The code should follow our rules and perhaps the most important: a super broad test suite would be awesome where one could see how the syntax works.

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

No branches or pull requests

5 participants