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

How to not lose comments and blank lines when js objects and yaml are converted to each other? #709

Open
huadee1108 opened this issue Jul 18, 2023 · 5 comments

Comments

@huadee1108
Copy link

image
Comments and blank lines are lost after conversion
image
@monaco-editor/react

@revolunet
Copy link

There is no official concept of "comment "in JSON

@webketje
Copy link

webketje commented Jan 25, 2024

But there is in json5 so this may be worth it

@alfierigaston
Copy link

README.md

@alfierigaston
Copy link

#709 (comment)

@TangentFoxy
Copy link

TangentFoxy commented Oct 16, 2024

Is there any progress on fixing this problem?

Edit: I know people think this isn't possible because of how JSON and YAML fundamentally work, but you can use a UUID key to store comment information. Even better, have the caller specify a key to use for comment data so conflicts can be avoided even in a worst case, or this can be ignored and not interfere with current usage. I know that comment order relative to other items is usually important as well, and this is its whole own problem, but it would be possible to introduce an optional key to store that metadata so it could be preserved as well.

(I care about this because obsidian.md uses this library to handle frontmatter, and it causes problems with plugins.)

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

5 participants