Skip to content

Block scalars does not follow indentation #292

@nervo

Description

@nervo

When marshalling a block scalar, the result does not follow custom indentation.

yaml.MarshalWithOptions(map[string]interface{}{
	"scalar": "foo\nbar\n",
}, yaml.Indent(4))

expected result:

scalar: |
    foo
    bar

actual result:

scalar: |
  foo
  bar

I've made a playground to illustrate the issue, comparing behaviors with other yaml library: https://go.dev/play/p/aaAtMUIt77R

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingencoder

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions