-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
commentBefore is null for yaml that has the comment at the beginning #600
Comments
The comment is getting attached to the key of the key-value pair. |
Thank you @eemeli , however, I cannot find any document about key-value pair, so can you share any code snippet about it? |
They're documented here: https://eemeli.org/yaml/#collections In a parsed document, |
Thanks for your information, based on the document, I tried below code, and still get undefined result: const yaml = require("yaml")
const fs = require("fs");
const yamlContent = fs.readFileSync("example.yaml", "utf8");
const parsedYaml = yaml.parseDocument(yamlContent);
console.log(parsedYaml.commentBefore); // null
console.log(parsedYaml.get("version", true).commentBefore); // undefined
console.log(parsedYaml.get("version", true).comment); // undefined |
Describe the bug
For yaml file
Use below js to parse it:
And the commentBefore is null
To Reproduce
Just as above
Expected behaviour
commentBefore should not be null
Versions (please complete the following information):
yaml
: 2.7.0.Additional context
No
The text was updated successfully, but these errors were encountered: