mdx-editor / mdx-editor/editor

[BUG] Code block not getting inserted inside list items

Open
#788 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
3.7k
Forks
307
Avg merge
14h 22m
Merged PRs (30d)
5

Description

Describe the bug

When inserting a code block within a numbered list in the MDX Editor, the code block is placed outside the list instead of being properly nested. This breaks the list numbering continuity.

Reproduction

Reproducible in the default editor environment with code block and lists plugins

To Reproduce
  1. Create a numbered list
  2. Place cursor at the end of a list item, suppose 2nd list item
  3. Click the "Insert code block" button
  4. Observe incorrect behavior : the list item breaks the list ordering and does not gets inserted in the list. The list items 2 resets to

###Expected Behavior
The code block should get inserted in list item 2 and the list item should continue

Actual behavior
  1. Code block appears outside list
  2. List numbering restarts
  3. List structure breaks
Additional context

The issue appears related to:

  • Missing indentation (needs 4 spaces/tab for nested code blocks)
  • Improper list continuation handling after code blocks
Screenshots

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the default editor environment with the code block and lists plugins, reproduce the issue by inserting a code block in the second numbered list item, and trace the insertion behavior. Done means the code block remains nested in the list item and subsequent list numbering continues without restarting.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.