Skip to content

[lexical-markdown] Bug Fix: Import emphasis and code spans that continue across a line break - #9465

Open
parinith-web wants to merge 3 commits into
meta:mainfrom
parinith-web:fix-markdown-inline-format-across-lines
Open

parinith-web wants to merge 3 commits into
meta:mainfrom
parinith-web:fix-markdown-inline-format-across-lines

Conversation

@parinith-web

Copy link
Copy Markdown

Closes #9444

Inline markdown (emphasis, code spans) is now parsed after the lines of a
paragraph, quote or list item have been merged, instead of line by line. A
delimiter opened on one line can therefore be closed on a later one, as
CommonMark allows.

The lines of a merged block are parsed as one string and split back into
LineBreakNodes afterwards, reusing the original nodes so hard line break
markers (trailing spaces or backslash) are preserved. Single-line blocks and
shouldPreserveNewLines behave as before.

Note: **a\nb** now imports as bold a, a line break, bold b, and exports
as **a**\n**b**. That is equivalent Markdown and re-imports to the same
document, but it is not byte-identical to the input. Exporting a format that
spans a line break as one span would be a separate change to the exporter.

Tests: new InlineFormatAcrossLines.test.ts.

@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 29, 2026 1:33pm UTC
lexical-playground Ready Ready Preview Oct 29, 2026 1:33pm UTC

Request Review

@conghuydever

Copy link
Copy Markdown

hello

This branch was successfully deployed

2 active deployments
Preview – lexical — cec402ea Deployed Oct 29, 2026 by vercel[bot]
Preview – lexical-playground — cec402ea Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Emphasis and code spans across a line break in a paragraph aren’t imported, and their delimiters are escaped on export

2 participants