Repository navigation
fix(markdown): keep soft break after inline nodes on deserialize - #5329
Merged
zbeyens merged 5 commits intoNov 4, 2026
Merged
Conversation
The default text rule stripped a leading newline from every text node, which joined the words around a soft break that follows a link, mark or inline code. Drop the newline only when the previous sibling is a <br> node, so the blockquote <br> case still yields a single newline. Fixes udecode#5321
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
🦋 Changeset detectedLatest commit: 97d0b3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…aragraphs The <br> inside a paragraph reaches the deserializer as an mdx br element, and the root-level <br /> paragraph relied on the text rule's strip. Treat an mdx br like an html br, and build the empty paragraph text as '' directly.
The text rule no longer strips a leading newline, so the root-level <br /> paragraph must not start with one.
The check that drops the line ending after a `<br>` now runs for the children of bold, italic and strikethrough, and it accepts a br tag with attributes, as `main` did before. Before, `**a<br>\nb**` gave two line breaks. Refs plate#5321
Member
On top of the PR
Verification
|
This was referenced Nov 4, 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.
Fixes #5321
Problem
deserializeMddropped a soft line break right after a link, mark or inline code (a [link](x)\nbbecamelinkb). Since #4200 the defaulttextrule stripped a leading\nfrom every text node.Fix
The leading newline is now dropped only when the previous sibling is a
<br>html node (the case the strip was added for, e.g.> line1<br>\n> line2). Thetextrule keeps its value as is.Tests
Added
softBreakAfterInline.spec.ts: link, emphasis, inline code and plain text keep\n, and the blockquote<br>case still gives a single\n. Patch changeset included.Verification
Not run locally (full monorepo checkout wasn't possible in my environment); relying on CI.