[lexical-markdown] Bug Fix: Preserve headings when typing list shortcuts - #8879
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
StevenPDang
marked this pull request as ready for review
July 26, 2026 17:23
StevenPDang
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
July 26, 2026 17:23
etrepum
approved these changes
Jul 26, 2026
Co-authored-by: Bob Ippolito <bob@redivi.com>
etrepum
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR prevents Markdown list shortcuts from replacing an existing HeadingNode when a list marker is typed at the beginning of the heading. Previously, markers such as
1.matched the list transformer based only on the block’s leading text, replacing the heading with a ListNode/ListItemNode and recording the transformation in history.List shortcut replacement now checks whether the source block is a heading. When it is, the transformer declines the replacement, preserving both the HeadingNode and the typed marker as normal heading text.
What changed
packages/lexical-markdown/src/MarkdownTransformers.ts — updates the shared list replacement function to skip shortcut
driven transformations when the parent block is a HeadingNode. Markdown import behavior is unchanged.
packages/lexical-markdown/src/tests/unit/LexicalMarkdown.test.ts — adds parameterized regression coverage for the
ordered marker
1.and unordered markers-,*, and+. Each case verifies directly that the block remains aHeadingNode and retains the complete typed text.
Backwards compatibility
No public APIs, types, transformer signatures, or serialized formats are changed.
Markdown import behavior remains unchanged. Shortcut behavior for paragraphs and other non-heading blocks is
preserved.
Test plan