Skip to content

v0.4.0

Compare
Choose a tag to compare
@braydonk braydonk released this 20 Sep 14:19
· 60 commits to main since this release
f3eff05

This release is smaller than the last few. I wanted to get a release out before I go on leave for a bit.

Changes

emoji_support

This is a combination of a fix and a feature; the yaml.v3 library does not properly parse emojis because it cannot properly print 4-byte UTF-8 characters. Hopefully that gets fixed soon, and #41 is open to track that when it happens. While this would be sensible to make a default behaviour, I've opted to default to false because it is a hack around a shortcoming of the upstream library.

retain_line_breaks

When this is enabled, yamlfmt will keep line breaks instead of deleting them. Similar to emoji_support, I would have liked to make this default but because it's a hack around a shortcoming of the library I'm defaulting it to false as well.

Functional Features architecture

This is an improvement to the API of the Basic Formatter, and features improvements to the base yamlfmt package as well. Previously, there were lots of special conditions tacked on before and after formatting in the Format function of the Basic Formatter, and it was becoming increasingly tangled when the needs of the function expanded. This improves the extensibility of the formatter, which allows for "features" to be created and added to be run as hooks before and after yaml formatting. Future formatters that I write in this package will use it. This marks an improvement to folks forking this tool and adding their own functionality in, provides a nicer basis for folks interested in writing their own formatters, and should hopefully make future contribution a lot more straightforward.

Diff improvement

I've made another improvement to the diff readability. The diff now shows side by side, making it far more easy to read. It still needs some more work, however I've separated that work into a new package that I will from here on incrementally improve in my spare time.

stdout output is more convenient

I had used fmt.Println to output to stdout in previous versions. This caused a problem for folks using yamlfmt as an editor integration, since yamlfmt already appends a newline to the formatted yaml. This release swapped to fmt.Print instead.

If you have any problems or suggestions, feel free to make an issue!

Contributors

Thanks to @longkai for the retaining line break feature and the fix to stdout output.

Changelog

  • d9d4189 chore: don't append new line at the end and keep the content as it is (#45)
  • f3eff05 engine: switched to multilinediff package (#47)
  • e05c99f fix #27 retain line break (#42)
  • 9fffda5 fix: line break format issue after refactor code (#44)
  • d9e8674 hotfix: add utf-8 parsint for emoji_support (#40)
  • 6da562a yamlfmt: added and implemented functional features (#43)