Rewrap icon indicating copy to clipboard operation
Rewrap copied to clipboard

Hyphen- and indentation-aware wrapping in YAML

Open rben01 opened this issue 2 years ago • 0 comments

In YAML, indentation is critical. When wrapping a long line that occurs after a hyphen, e.g.,:

- my very very very very very very very very very very very very very very very very very very very very very long item

The output is

- my very very very very very very very very very very very very very very very very
very very very very very long item

However, this is no longer valid syntax, as wrapped lines must be indented an additional two spaces from the hyphen (so that they line up with the start of the text on the line with the hyphen). The correct indentation would be:

- my very very very very very very very very very very very very very very very very
  very very very very very long item

Would it be possible for rewrap to insert the additional two spaces (or whatever the file’s indentation is) when wrapping in a YAML file?

rben01 avatar Mar 28 '23 02:03 rben01