js-yaml
js-yaml copied to clipboard
Allow compact mode with indent !== 2
I like compact mode for arrays, but it is disabled if indent is !== 2
Cf this line of code: https://github.com/nodeca/js-yaml/blob/master/lib/js-yaml/dumper.js#L697
I'd like to have an output like this:
title:
source: hello
steps:
- step1
- name: step2
attr: stepInfo
Instead of this:
title:
source: hello
steps:
- step1
-
name: step2
name: stepInfo
What do you think about this format ?
Is there a way to configure the 'compact' mode for arrays? In Version 3.14 I get
array:
- object: 1
name: O1
- object: 2
name: O2
but would like to get it like:
array:
-
object: 1
name: O1
-
object: 2
name: O2
The first one throws errors in java eoyaml parser:
com.amihaiemil.eoyaml.exceptions.YamlIndentationException: Indentation of line 3 is greater than the one of line 2. It should be less or equal.
Guys, is there an update on this? Any workaround?