markdown: render hard line breaks instead of concatenating lines - #2945
Merged
Conversation
Cover both CommonMark spellings of a hard break — two trailing spaces and a trailing backslash — so the `Node::Break` arm cannot be dropped again without a test failing. Verified by removing the arm: the test fails with 2 children instead of 3. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DJzGY5rMeCxE2r5L6MFzAS
huacnlee
enabled auto-merge (squash)
September 4, 2026 10:39
Member
|
Thanks. |
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.
parse_paragraphhas no arm forNode::Break, so a CommonMark hard break — twotrailing spaces or a backslash — is silently dropped and the adjacent lines are
joined.
Reproduction
Renders as
…ID: 338673110Persona: assistanton one line. Expected two lines.Measured on a 3 874-note vault: hard breaks appear in the source of a meaningful
share of notes, and every one of them rendered wrong.
Fix
Mirror the inline-HTML
<br>path: emit a newline inline node forNode::Break.Seven lines,
crates/base/src/text/format/markdown.rsonly.Note this is a hard break fix. Soft breaks (a plain newline inside a
Textnode) are a separate, opposite defect — they render as hard breaks — and are a
separate PR, since the two are distinguishable in
mdastand should stay so.