Skip to content

Bug: backslash injection in numbered list edge case #7824

@joh-ku

Description

@joh-ku

Lexical version: v0.35.0

Description:

I've encountered an issue where the markdown editor mistakenly injects an additional backslash (\). This seems to be an edge case that occurs when a numbered list pattern is used within a bullet point list.

Steps to Reproduce

Step 1

Insert the below markdown content into the lexical playground:

A test:

- 1\. foo
- 5.: bar

Note: Without the backslash, the first list item, - 1\. foo will be interpreted as bullet list and numbered list both at the same time.

Step 2

Switch between WYSIWYG and markdown mode.

Expected Behavior:

The escaped dot (1\.) should remain unchanged and render correctly without triggering numbered list formatting. The content should display as a simple bullet point list item in the WYSIWYG editor.

Actual Behavior:

Upon switching back to the normal editor, the markdown content is altered to:

- 1\\. foo

The editor adds an extra backslash, resulting in 1\. in WYSIWYG mode as well as in the final target content format.

Use Case:

I want to display a bullet point list where each item starts with a number (representing a time-stamp like a minute of an event) followed by a description. The number should not trigger automatic numbered list formatting.

Additional Context:

This bug was observed using Sveltia CMS and the downstream bug report can be found here.

Link to code example

The issue can be reproduced by copying the above (Step 1) sample into the lexical playground and switch between WYSIWYG and markdown mode.

Impact of fix

Everybody, who wants to mix bullet point and numbered list items, would benefit from this fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions