Closed
Description
Describe the bug
If there's a large block of comments hanging indented under a key, that can trigger an error suggesting that the next key indicator is too far away.
To Reproduce
const comment = `# Test comment
owners:
# Test comment
business:
- email: great.googly@fortitude.com
name: Moogly
- distributionList: HopsNBops@easterbunny.org
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
stage: one
`;
console.log(yaml.parse(comment));
The script produces the error:
YAMLParseError: The : indicator must be at most 1024 chars after the start of an implicit block mapping key at line 22, column 1:
# large block of text, large block of text, large block of text, large block of…
stage: one
^^^^^
Removing the indent from the first block of comments works around the error.
Expected behaviour
The text is valid YAML, it should be parsed, no matter how many comments there are or whether they're indented.
Versions (please complete the following information):
- Environment: Node.js 16.15.1
yaml
: 2.1.1