Comparing version 2.2.0 to 2.2.1
@@ -233,3 +233,3 @@ import { Scalar } from '../nodes/Scalar.js'; | ||
const { type, value } = item; | ||
const { actualString, implicitKey, indent, inFlow } = ctx; | ||
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx; | ||
if ((implicitKey && /[\n[\]{},]/.test(value)) || | ||
@@ -258,5 +258,10 @@ (inFlow && /[[\]{},]/.test(value))) { | ||
} | ||
if (indent === '' && containsDocumentMarker(value)) { | ||
ctx.forceBlockIndent = true; | ||
return blockString(item, ctx, onComment, onChompKeep); | ||
if (containsDocumentMarker(value)) { | ||
if (indent === '') { | ||
ctx.forceBlockIndent = true; | ||
return blockString(item, ctx, onComment, onChompKeep); | ||
} | ||
else if (implicitKey && indent === indentStep) { | ||
return quotedString(value, ctx); | ||
} | ||
} | ||
@@ -263,0 +268,0 @@ const str = value.replace(/\n+/g, `$&\n${indent}`); |
@@ -235,3 +235,3 @@ 'use strict'; | ||
const { type, value } = item; | ||
const { actualString, implicitKey, indent, inFlow } = ctx; | ||
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx; | ||
if ((implicitKey && /[\n[\]{},]/.test(value)) || | ||
@@ -260,5 +260,10 @@ (inFlow && /[[\]{},]/.test(value))) { | ||
} | ||
if (indent === '' && containsDocumentMarker(value)) { | ||
ctx.forceBlockIndent = true; | ||
return blockString(item, ctx, onComment, onChompKeep); | ||
if (containsDocumentMarker(value)) { | ||
if (indent === '') { | ||
ctx.forceBlockIndent = true; | ||
return blockString(item, ctx, onComment, onChompKeep); | ||
} | ||
else if (implicitKey && indent === indentStep) { | ||
return quotedString(value, ctx); | ||
} | ||
} | ||
@@ -265,0 +270,0 @@ const str = value.replace(/\n+/g, `$&\n${indent}`); |
{ | ||
"name": "yaml", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "author": "Eemeli Aro <eemeli@gmail.com>", |
651418
17417