-
Notifications
You must be signed in to change notification settings - Fork 48
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
#magic___^_^___line
when retain_line_breaks: true
#84
Comments
Thanks for making an issue and the kind words! This appears to be a strange edge case of scanning folded block scalars, something that's been a hassle. There's two bits of weirdness, one of which The one with a workaround is that the underlying yaml library cuts out lines for folded block scalars. This actually kind of makes sense, since that's a correct interpretation of folded block scalars from the spec, however it's really uncool for a tool like this where we want to maintain that form. For that, I've implemented a feature in the yaml library that forces re-encoding folded block scalars to retain the line breaks. I added a boolean option in the formatter config called The second weirdness is something I actually discovered just now while reproducing the issue. If a line in a folded block scalar ends with space characters, the encoder throws a fit and dumps the raw string value instead of producing a folded block scalar as intended. If whitespace is left at the end of a folded block scalar, you get output like this: Foobar:
baz: "Lorem Ipsum is simply dummy text of the printing_and_typesetting industry.
\n#magic___^_^___line\n"
Foobaz:
baz: "foobar" This is a really annoying consequence, and I'll start tackling it soon. That being said, hopefully |
You are indeed correct! With |
Hello, thanks for a really neat and fast tool! Seems to work fantastic in our mono-repo.
I noticed something strange though when formatting this minimal example:
which will get formatted into:
with the following config:
I guess there is some problem in
internal/hotfix/retain_line_break.go
but could not see where.The text was updated successfully, but these errors were encountered: