Open marcoroth opened 1 week ago
Hi @marcoroth thanks for opening an issue.
These types of newline nuances are fraught with complications, and I've lost count of the number of times over the years I've tried to fix them and come up short. This is probably going to fall into the same bucket of problems that it's unlikely I'm going to fix any time soon. Thank you for the additional data, it's good to know more edge cases where the library screws this up. I can't promise this will be fixed any time soon though, sorry.
Hey @braydonk, thanks for the reply and the openness - this goes a long way. I can work around it for now, thank you!
yamlfmt
encounters an error when parsing YAML files that contain block scalars (|-
) with an initial newline after the block scalar indicator. This results in a parsing failure with the following error message:The issue occurs when the YAML content is formatted as follows:
However, if the initial newline after the
|-
is removed, the cotent is getting parsed correctly:Expected Behavior
yamlfmt
should correctly parse and format YAML content that includes an initial newline after a block scalar indicator (|-
). As far as I can tell this seems to be supported in YAML.Steps to Reproduce
Create a YAML file (
file.yml
) with the following content:Run
yamlfmt
on the file:Observe the parsing error: