Configure default line width for string widget
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
**Is your feature request related to a problem? Please describe.**
The YAML library that the CMS uses has a default line width of `80` when writing content to front matter (may apply in other cases). This causes an issue when using the `string` widget as it inserts a newline at the 80 character mark but does **not** use YAML folding, so plain text is inserted on its own line. This is known to break site builds on Hugo, Pelican, and probably others:
`Error: Error building site: "site/content/author/author-name/index.md:6:1": failed to unmarshal YAML: yaml: line 5: could not find expected ':'`
Workarounds include switching to the text widget or using a max character count, but we shouldn't need to do that.
**Describe the solution you'd like**
Remove the line wrapping feature or disable it on strings. It feels like an opinionated way of making your code look pretty when many people have other ways of doing this, ex: Prettier on VSC (which coincidentally has the same default, but won't break the YAML structure).
I think this won't happen based on feedback from @erezrokah on breaking existing content, but the full impact hasn't been explored yet.
**Describe alternatives you've considered**
1. Implement [YAML folding](https://yaml-multiline.info/) to keep this feature but not have it break sites. Seems like it'd be very easy
2. Allow [configuration](https://github.com/eemeli/yaml/issues/58) on the string widget to remove or increase the limit
**Additional context**
Original forum post: [String fields have newlines added to Markdown front matter](https://answers.netlify.com/t/string-fields-have-newlines-added-to-markdown-metadata-front-matter-which-breaks-pelican/18069)
Contributor guide
Assessment
This issue has not been assessed yet.