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

Issue: FrontMatter changes front matter line length #518

Closed
davidsneighbour opened this issue Mar 1, 2023 · 6 comments
Closed

Issue: FrontMatter changes front matter line length #518

davidsneighbour opened this issue Mar 1, 2023 · 6 comments
Labels

Comments

@davidsneighbour
Copy link
Contributor

Describe the bug
It appears the frontmatter functionality that updates the dates on save is also formatting the frontmatter. I have a line with the length of >80, but below 120 and after each save that line is ripped onto two lines. Now, while this is done properly (yaml, second line of a parameter is indented by 2 extra spaces) it might/will break other parsers that want to go over frontmatter. It would be nice to be able to either configure it to a certain line length or be able to disable it.

I am not 100% sure that it is FrontMatter doing this, but I disabled all Markdown extensions, eslint and prettier and it still cut the line in two, after disabling frontmatter this stopped.

sample:

---
date: 2023-02-26T21:27:05+07:00
publishDate: 2023-02-26T21:27:05+07:00
lastmod: 2023-02-27T17:20:47+07:00
resources:
  - src: header.jpg
    title: Photo by [Todd Quackenbush](https://unsplash.com/@toddquackenbush) via [Unsplash](https://unsplash.com/)
---

ends up as:

---
date: 2023-02-26T21:27:05+07:00
publishDate: 2023-02-26T21:27:05+07:00
lastmod: 2023-03-01T18:50:15+07:00

resources:
  - src: header.jpg
    title: Photo by [Todd Quackenbush](https://unsplash.com/@toddquackenbush) via
      [Unsplash](https://unsplash.com/)
---
@davidsneighbour davidsneighbour added the bug Something isn't working label Mar 1, 2023
estruyf added a commit that referenced this issue Mar 2, 2023
@estruyf
Copy link
Owner

estruyf commented Mar 2, 2023

Thanks @davidsneighbour, found the issue. It seems to be caused by the YAML parser. I did an update to it, and now it should not break your lines anymore.

Let me know if this fixed it for you in the beta version.

@davidsneighbour
Copy link
Contributor Author

Yes, that fixes it. Thank you :)

@davidsneighbour
Copy link
Contributor Author

davidsneighbour commented Mar 5, 2023

I hate to be of bother ;) But now it removes all empty lines that I use just to keep an overview over the front matter. That is ok and valid and I think the initial issue is worse than that, but maybe it's easy to save empty lines the front matter?

(Or it's maybe another issue? Still using the Beta Version)

@estruyf
Copy link
Owner

estruyf commented Mar 6, 2023

No worries, we need to get this right. The issue is in one of the YAML parsers, one has a setting to set a line length, but seems to remove other things, and the other one keeps things in place but doesn't have a line length setting.

@estruyf
Copy link
Owner

estruyf commented Mar 6, 2023

Just saw that with the latest version of the YAML parser, there is a line width option. I just updated the dependency and made the change. This gets the old experience back + the fix for the line width.

@davidsneighbour
Copy link
Contributor Author

davidsneighbour commented Apr 11, 2023

It appears this did not make it into 8.4.0 or got somehow broken again. Saving markdown files removes empty lines currently in v8.4.0. The line length is working.

edit: not sure if a closed issue arrives on your notifications, so I'll ping you @estruyf ;)

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

No branches or pull requests

2 participants