Closed wlynch closed 3 months ago
Hey there — I'm not quite following the scenario yet... do you have an example file on hand where we could reproduce what you're seeing? There are a few known bugs with the underlying go-yaml
library regarding comment handling, so curious if it's one of those, or if it's something we have more control over in yam itself 🤞
Sure! So this config:
update:
enabled: true
exclude-reason: >
blah blah blah
1. a
2. b
3. c
asdf
with this config:
gap:
- "."
- ".subpackages"
- ".data"
- ".pipeline"
- ".update.exclude-reason"
indent: 2
becomes:
update:
enabled: true
exclude-reason: >
blah blah blah
1. a 2. b 3. c
asdf
The desire is that the list formatting would be preserved
1. a
2. b
3. c
Gotcha! I'm wondering if this has to do with understanding the YAML spec. Multiline strings behave differently based on the first character used, like |
vs. >
.
>
indicates a folded scalar, meaning we want newlines to be treated as spaces unless there's an empty line or a more indented line.|
indicates a literal scalar, meaning we want newlines to be preserved as is.If you replace the >
with a |
, does this do what you're looking for?
This does indeed work! TIL - thanks! 🎉
For some fields (like
update.exclude comment
) we may include list for details comments e.g.or
Currently yam doesn't know how to handle these, because it treats them as a gap-less multiline string, and ends up collapsing these into a single line. Really we want to treat this more like markdown and preserve this whitespace.