Skip to content

For an empty multi line input like |- is getting replace with '' #630

@yadavjay8887

Description

@yadavjay8887

Describe the bug
For an empty multi line input like |- is getting replace with ''

To Reproduce
Steps to reproduce the behaviour.

When parsing a YAML document containing an empty block scalar using |- (block literal).
Then serializing it back with .toString(), the scalar is converted to a plain quoted string ('').
Losing its original formatting.

Input YAML
input: |-

Output YAML
input: ''

Expected behaviour
A clear and concise description of what you expected to happen.

Input YAML

input: |-

Output YAML

input: |-

Versions (please complete the following information):

  • Environment:
  • Node.js 22.14.0
  • yaml: 2.6.1

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions