Skip to content

Soft line breaks in new richtext widget #7816

@delucis

Description

@delucis

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 <br> element.)

Screenshots

Here’s an example of soft line breaks in the editor and rendering without breaks in the preview pane:

Decap CMS showing richtext widget on the left and preview pane on the right

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:

		{
			name: 'body',
			label: 'Page contents',
			widget: 'richtext',
			buttons: ['bold', 'italic', 'link', 'heading-two', 'quote'],
			editor_components: ['image'],
			modes: ['rich_text'],
		},

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions