Skip to content

the option doubleQuotedMinMultiLineLength for yaml.stringify is not working as intended #512

@aayshasura

Description

@aayshasura

Describe the bug
I am encountering an issue with the doubleQuotedMinMultiLineLength option in the yaml.stringify function that doesn't seem to behave as expected. The option in yaml.stringify doubleQuotedMinMultiLineLength is supposed to set min length of the double quoted string that should not be seperated to multiline with \. This is'nt an issue for single quoted strings or strings with no quotes in YAML Map representation.

To Reproduce
try to parse a yaml doc where a double quoted string is present as a YAMLMap and stringify it with options = {doubleQuotedMinMultiLineLength: x}, regardless of what x is the split is always happening from 76th character even though in the docs it is by default 40.

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

I expect the doubleQuotedStrings present in the YAMLMap to be split to multiline with escape character \ only after the length passed in as options. if the options = {doubleQuotedMinMultiLineLength: 2} it should split to multiline after 2 characters and if its 400 it should split into multiline with escape character after 400 characters.

Versions (please complete the following information):

  • Environment: [e.g. Node.js 14.7.0 or Chrome 87.0]
  • yaml: [e.g. 1.10.0 or 2.0.0-2]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation should be improved

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions