You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The newlines in the plain scalar are collapsed into spaces, so they're lost in the parsing. They are of course in the CST, but retaining them for Document stringification as well could be nice, though tricky to do without impacting users who don't care about them.
Preserving multi-line values "exactly as it is" is also rather tricky, as the structure around the node can change, and it can become more or less indented as a result.
There could be something in the stringifier that might check the srcToken value (the node's CST token, retained if keepSourceTokens: true is set), re-parse that to see if it matches the current value, and if so, determine a common indent to remove from each line past the first, and then use that in the serialization. There probably are a bunch of corner cases here that I'm not thinking of right away, but I'd be happy for someone to look into this.
Describe the bug
A clear and concise description of what the bug is.
Running
parseDocument(content).toString()
on the following:is changing it to:
Expected behaviour
The original value should be preserved exactly as it is.
Versions (please complete the following information):
yaml
andnode
latestThe text was updated successfully, but these errors were encountered: