Skip to content

Ending comments got lost after stringify #576

Closed
@longkai

Description

Describe the bug

Do parsing the text then format it.

  let doc = YAML.parseDocument(text);
  console.log(YAML.stringify(doc));

To Reproduce

input text:

a:   1
#a: 1
# b: 2

got result:

a: 1

Expected behaviour

a: 1
#a: 1
# b: 2

Versions (please complete the following information):

  • Environment: Node.js v22.6.0
  • yaml: 2.5.1

Additional context

None

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