Soft line breaks in new richtext widget
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
**Describe the bug**
In the new `richtext` widget, soft line breaks (shift + enter) do not emit a line break in the final Markdown. In the old `markdown` widget these would emit `\` at the end of the line to force a hard line break, but the new widget doesn’t include this, causing many Markdown renderers (including Decap’s built-in preview) to ignore the newline.
**To Reproduce**
1. Open an item in the CMS that uses the `richtext` widget.
2. Add some text that includes soft line breaks (e.g. type while using shift + enter to break up your text)
3. Observe that no line breaks are shown in the preview pane
4. Observe that when saving the item, the Markdown output includes newlines but no trailing `\`.
**Expected behavior**
The editor should output `\` at the end of soft line breaks like the `markdown` widget does. (Or an alternative like a `
` element.)
**Screenshots**
Here’s an example of soft line breaks in the editor and rendering without breaks in the preview pane:
**Applicable Versions:**
- Decap CMS version: 3.12.2
- Git provider: not relevant
- OS: macOS
- Browser version: Firefox 150
- Node.JS version: 24.15.0
**CMS configuration**
It’s a lot in my case, but here’s a relevant `fields` config:
```js
{
name: 'body',
label: 'Page contents',
widget: 'richtext',
buttons: ['bold', 'italic', 'link', 'heading-two', 'quote'],
editor_components: ['image'],
modes: ['rich_text'],
},
```
Contributor guide
Assessment
This issue has not been assessed yet.