-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Assigning commentBefore on a Pair #157
Comments
In order to add a comment before a pair, you'll want to add that comment before the pair's key, i.e. the Currently, the smallest change needed to do what you want would be something like this: const pair = new Pair(YAML.createNode('foo'), 'bar')
pair.commentBefore = ' This is a pair'
doc.add(pair) Now, clearly something needs to change in order to make that less painful. I'm just not sure what. Brainstorming, at least the following are possible:
Thoughts on the above are quite welcome. |
Ah! I somehow missed that I can make each part of the I can tell you that as a first time user, the behavior wasn't quite what I expected for
I expect that changing the behavior of Regarding the original issue, I guess I'd say that as a user, I think better error messages with some direction on how to fix it would be a sufficient solution. An ideal solution would make it "just work" the way I tried, but only if it can be done without any negative side-effects. |
I want to add a pair to my document with a comment before the pair, e.g.:
I tried doing this using this code:
But when I run the code, I get the following error:
As a more general question, how can I use YAML to create a document that has line comments preceding key/value pairs and/or line comments after a pair? E.g., what's the best way to do something like this:
using yaml 1.9.2
The text was updated successfully, but these errors were encountered: