decaporg / decaporg/decap-cms

YAML comments get removed

Open
#5,099 5 comments 0 reactions 0 assignees View on GitHub
area: formats area: ui/editor type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**
I have a YAML file with some comments at the top. This file is linked to a collection in the CMS. I edit the file through the CMS. The comments are removed.

**To Reproduce**
1. Have a file collection pointing to a YAML file
2. Make sure you have commented lines at the top of that YAML file
3. Edit the file through the CMS
4. Inspect the PR and watch those comments vanish

**Expected behavior**
Comments stay there.

**Applicable Versions:**

- Netlify CMS version: 2.14.29
- Git provider: GitHub
- OS: macOS 11.0.1
- Browser Brave v1.19.92

- Node.JS version: v12.17.0

**CMS configuration**
```yml
collections:
- name: 'something'
label: 'Something'
editor:
preview: false
files:
- label: 'My file'
name: 'my_file'
file: '_data/my_file.yml'
fields:

```

`my_file.yml`:
```yml
# Oh hai!
# These are just some comments.
# Nevermind these. And definitely, don't remove them.

some:
thing: 'Only a test'
```

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.