google / google/yamlfmt

feat: Support a flag to preserve blank lines during formatting

Open
#228 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.8k
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Currently, `yamlfmt` preserves original blank lines only when `retain_line_breaks: true` is set in a configuration file. It would be great to have a direct command-line option, like `--preserve-blank-lines`, to achieve the same behavior without relying on a config file.

To make this even more user-friendly, could we introduce a simple shorthand as well? Since no existing shorthand uses `-p`, how about `-p` as a shortcut for `--preserve-blank-lines`? This would give users a quick and easy way to keep their original blank lines intact, which is especially helpful for ad-hoc formatting tasks or integrating `yamlfmt` into scripts and CI workflows.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.