Describe the bug
Hello there. First off great library! Thank you for making it.
I'm running into an issue with comments and I'm wondering if there is an option to turn it off.
The issue: It looks like inline comments on keys are being moved
Input yaml
tutorial: #nesting level 1
- yaml: #nesting level 2 (2 spaces used for indentation)
name: YAML Ain't Markup Language #string [literal] #nesting level 3 (4 spaces used for indentation)
type: awesome #string [literal]
born: 2001 #number [literal]
Produces
tutorial:
#nesting level 1
- yaml:
#nesting level 2 (2 spaces used for indentation)
name: YAML Ain't Markup Language #string [literal] #nesting level 3 (4 spaces used for indentation)
type: awesome #string [literal]
born: 2001 #number [literal]
#nesting level 1 and #nesting level 2 (2 spaces used for indentation) have moved
here's the diff
- tutorial: #nesting level 1
+ tutorial:
+ #nesting level 1
- - yaml: #nesting level 2 (2 spaces used for indentation)
+ - yaml:
+ #nesting level 2 (2 spaces used for indentation)
name: YAML Ain't Markup Language #string [literal] #nesting level 3 (4 spaces used for indentation)
type: awesome #string [literal]
born: 2001 #number [literal]
To Reproduce
Steps to reproduce the behaviour.
const originalString = `
tutorial: #nesting level 1
- yaml: #nesting level 2 (2 spaces used for indentation)
name: YAML Ain't Markup Language #string [literal] #nesting level 3 (4 spaces used for indentation)
type: awesome #string [literal]
born: 2001 #number [literal]`
const originalYamlDoc = yaml.parseDocument(originalString.trim());
const outputTest = new yaml.Document(originalYamlDoc)
const outputTestStr = outputTest.toString()
console.log(outputTestStr) // string with comments shifted
Expected behaviour
keep comments on the same line where the key is.
I think I can work around this with some custom mapping but I was wondering if there was an option to toggle to avoid this in the first place.
Thank you again for the great lib ❤️
Describe the bug
Hello there. First off great library! Thank you for making it.
I'm running into an issue with comments and I'm wondering if there is an option to turn it off.
The issue: It looks like inline comments on keys are being moved
Input yaml
Produces
#nesting level 1and#nesting level 2 (2 spaces used for indentation)have movedhere's the diff
To Reproduce
Steps to reproduce the behaviour.
Expected behaviour
keep comments on the same line where the key is.
I think I can work around this with some custom mapping but I was wondering if there was an option to toggle to avoid this in the first place.
Thank you again for the great lib ❤️