We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 92821f2 commit 70a8db3Copy full SHA for 70a8db3
2 files changed
src/stringify/stringifyPair.ts
@@ -127,7 +127,7 @@ export function stringifyPair(
127
ws += `\n${indentComment(cs, ctx.indent)}`
128
}
129
if (valueStr === '' && !ctx.inFlow) {
130
- if (ws === '\n') ws = '\n\n'
+ if (ws === '\n' && valueComment) ws = '\n\n'
131
} else {
132
ws += `\n${ctx.indent}`
133
tests/doc/stringify.ts
@@ -398,6 +398,19 @@ z:
398
'{\n a:\n #c\n ,\n b:\n}\n'
399
)
400
})
401
+
402
+ test('Single newline after key with empty value', () => {
403
+ const src = source`
404
+ map:
405
+ item:
406
407
+ anothermap:
408
+ anotheritem:
409
410
+ `
411
+ const doc = YAML.parseDocument(src)
412
+ expect(String(doc)).toBe(src)
413
+ })
414
415
416
describe('properties on collections in block mapping', () => {
0 commit comments