Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block scalars does not follow indentation #292

Open
nervo opened this issue Apr 29, 2022 · 0 comments · May be fixed by #625
Open

Block scalars does not follow indentation #292

nervo opened this issue Apr 29, 2022 · 0 comments · May be fixed by #625
Assignees
Labels
bug Something isn't working encoder

Comments

@nervo
Copy link
Contributor

nervo commented Apr 29, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working encoder
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants