Skip to content

fix(remark-stringify): omit trailing breaks that cannot round-trip - #1497

Open
BetterAndBetterII wants to merge 1 commit into
remarkjs:mainfrom
BetterAndBetterII:fix/trailing-break-stringify
Open

fix(remark-stringify): omit trailing breaks that cannot round-trip#1497
BetterAndBetterII wants to merge 1 commit into
remarkjs:mainfrom
BetterAndBetterII:fix/trailing-break-stringify

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Drop trailing break nodes on stringify so they do not round-trip as a literal backslash under CommonMark. Mid-phrasing breaks are unchanged. Fixes #1477

CommonMark cannot parse a trailing `\`+newline as a hard break, so
emitting one turned a trailing break into a literal backslash on parse.
Drop trailing breaks on stringify; keep mid-phrasing breaks unchanged.

Fixes remarkjs#1477
@github-actions github-actions Bot added the 👋 phase/new Post is being triaged automatically label Aug 29, 2026
@github-actions

Copy link
Copy Markdown

Hi! It seems you removed the template which we require. Here are our templates (pick the one you want to use and click *raw* to see its source):

I won’t send you any further notifications about this, but I’ll keep on updating this comment, and hide it when done!

Thanks,
— bb

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (334415d) to head (f3c551a).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1497   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          138       173   +35     
=========================================
+ Hits           138       173   +35     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ChristianMurphy

Copy link
Copy Markdown
Member

Thanks @BetterAndBetterII!
I'm not sure the solution direction is fully decided yet for this #1477 (comment)
And when it is, if it requires a change, it would go in mdast-util-to-markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👋 phase/new Post is being triaged automatically

Development

Successfully merging this pull request may close these issues.

Roundtrip loss: trailing break node in paragraph serializes but doesn't parse back

2 participants