Open TristanCacqueray opened 4 years ago
Yes, line spaces and extra indentation is not preserved in a round trip. See https://hackage.haskell.org/package/HsYAML-0.2.1.0/docs/Data-YAML-Event.html#g:4 for more details.
My use-case is to edit/format YAML document while preserving the file structure, and loosing empty lines is not very practical. It doesn't seems like a very intrusive change to add EmptyLine
event and I would be interested in contributing such a feature if that would be acceptable (and fit the scope of HsYAML
).
I also noticed parseEvents
returns a list of Event, Pos
Record, but writeEvents
only accept a list of Event
. Is there a particular reason a writeEventsWithPos
function isn't provided? And if such function is technically feasible, then that seems like a better solution to my use-case.
It would be nice to have such a feature. Any suggestions @hvr on how to proceed with this feature?
It seems like empty lines do not have a corresponding Event:
Results in (after passing through
yaml-test yaml2yaml
):Would it be possible to add a new event or comment attribute to preserve empty lines?