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

Enhancement: preserve front matter comments when modifying content via the Front Matter UI #835

Open
olets opened this issue Aug 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@olets
Copy link

olets commented Aug 4, 2024

Is your feature request related to a problem? Please describe.

I often add comments to front matter. For example

relatedPosts:
  - fxcf9e6db7765 # the post about x
  - c473788b6886 # the post about y

If I use the Front Matter UI to update content —for example by clicking the "now" button on a datetime field— those comments are deleted.

Describe the solution you'd like

Preserve comments when changes via the UI trigger rewriting the front matter. Change only what I explicitly changed.

Describe alternatives you've considered

Currently I git-add files before using the FrontMatter UI, then use the Front Matter UI, then check the un-cached diff and remove any changes I didn't ask for.

Additional context

I think this is distinct from

which appears to be about comments in the Front Matter config.

@olets olets added the enhancement New feature or request label Aug 4, 2024
@estruyf
Copy link
Owner

estruyf commented Aug 5, 2024

Thanks, @olets, for opening this issue. Comments in YAML are tricky. I have yet to find a good YAML parser that can preserve those comments. The difficulty is in converting the YAML to JSON where all comments are lost, and then back to YAML where they need to be included again.

I'll try to see if there is any progress since the issue you referred to on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants