Configure default line width for string widget
See original GitHub issueIs 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
- Implement YAML folding to keep this feature but not have it break sites. Seems like it’d be very easy
- Allow configuration on the string widget to remove or increase the limit
Additional context Original forum post: String fields have newlines added to Markdown front matter
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
True - we’ll need to make sure we only quote strings (or use the
>
format).But for strings this wouldn’t be an issue right?
Yep this works exactly how the result shows 👍