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

Linebreaks in block fold field is not preserved #586

Closed
saravmajestic opened this issue Oct 21, 2024 · 1 comment
Closed

Linebreaks in block fold field is not preserved #586

saravmajestic opened this issue Oct 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@saravmajestic
Copy link

Describe the bug
In my yaml file, i have block fold field description with a line break as in below code

version: 2
tables:
  - name: customers

    description: >
      This table has basic information about a customer. 
      As well as some derived facts based on a customer's orders

When I parse the contents as document and save it to a file, the line breaks are not preserved

const yaml = require("yaml");
const fs = require("fs");
const path = require("path");

const fileContents = fs.readFileSync(
  path.resolve(__dirname, "test.yml"),
  "utf8",
);

const parsedDoc = yaml.parseDocument(fileContents, {});
fs.writeFileSync(
  path.resolve(__dirname, "test1.yml"),
  yaml.stringify(parsedDoc, {}),
);

Ouput:

version: 2
tables:
  - name: customers

    description: >
      This table has basic information about a customer.  As well as some
      derived facts based on a customer's orders

Is it possible to restore the line breaks when saving the file?

To Reproduce
Mentioned above

Expected behaviour
Line breaks in block fold should be preserved

Versions (please complete the following information):

  • Environment: node 20
  • yaml: 2.6.0

Additional context
Add any other context about the problem here.

@saravmajestic saravmajestic added the bug Something isn't working label Oct 21, 2024
@eemeli
Copy link
Owner

eemeli commented Oct 21, 2024

Closing as a duplicate of #572, see answer there.

@eemeli eemeli closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants