denoland / denoland/std

Yaml library drops comments when round tripping

Open
#3,307 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

If I parse a yaml file, edit it then save it back, it drops all comments.

**Steps to Reproduce**

```ts
import {
parse,
stringify,
} from "https://deno.land/std@0.182.0/yaml/mod.ts";

const result = stringify(parse(`
# comment
name: example
`));

console.log(stringify(result)) // name: example
```

**Expected behavior**

I expect all code comments to be preserved.

**Environment**

```
deno 1.31.3 (release, x86_64-apple-darwin)
v8 11.0.226.19
typescript 4.9.4
```
- std version: `0.182.0`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.