Skip to content

feat(MDX): add optional hard breaks option#1406

Open
eaglethrost wants to merge 3 commits intonextfrom
dimas/cx-2095-line-break-characters-in-descriptions-arent-being-processed
Open

feat(MDX): add optional hard breaks option#1406
eaglethrost wants to merge 3 commits intonextfrom
dimas/cx-2095-line-break-characters-in-descriptions-arent-being-processed

Conversation

@eaglethrost
Copy link
Copy Markdown
Contributor

@eaglethrost eaglethrost commented Mar 27, 2026

🎫 Resolve CX-2095

Summary

  • Adds an optional hardBreaks flag to the MDX compile() function that enables remark-breaks, converting soft line breaks (\n) into hard breaks (<br>)
  • This would allow text like hello \n there to be split now
  • Disabled by default to preserve existing behavior, different app components can opt in as needed

Context

The legacy rendering engine parsed newline characters as line breaks. Some customers want this behaviour in refactored, such as in API descriptions in the API explorer (see attached linear ticket), hence we should have an option in the MDX rendering to allow that. See also this linear comment: https://linear.app/readme-io/issue/CX-2095/line-break-characters-in-descriptions-arent-being-processed-correctly#comment-a6580c9e

If we agree to do this, we would need to also update the readme side to use the new flag for UI areas that need this behaviour.

@eaglethrost eaglethrost changed the title feat: add optional hard breaks support to MDX compile feat(MDX): add optional hard breaks option Mar 27, 2026
@eaglethrost eaglethrost marked this pull request as draft March 27, 2026 12:36
@eaglethrost eaglethrost marked this pull request as draft March 27, 2026 12:36
@eaglethrost eaglethrost marked this pull request as ready for review March 27, 2026 12:55
@eaglethrost eaglethrost requested review from rafegoldberg and removed request for rafegoldberg March 27, 2026 12:55
@eaglethrost eaglethrost requested a review from rafegoldberg April 7, 2026 13:21
Copy link
Copy Markdown
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lgtm but would love a second approval from @rafegoldberg or @dannobytes

@erunion erunion requested a review from dannobytes April 20, 2026 19:13
@rafegoldberg
Copy link
Copy Markdown
Contributor

@eaglethrost will this option make it match Xish?

@rafegoldberg
Copy link
Copy Markdown
Contributor

Not a huge fan of adding any extra flags or optional behavior unless it's absolutely one thousand percent necessary.

@eaglethrost
Copy link
Copy Markdown
Contributor Author

eaglethrost commented Apr 21, 2026

@eaglethrost will this option make it match Xish?

Yes it will, and legacy as well

Not a huge fan of adding any extra flags or optional behavior unless it's absolutely one thousand percent necessary.

Yeah honestly I think we're doing this just because a customer wants the behaviour. I don't think we should make it the default as it will affects thousands of documents unexpectedly, hence why I made it an option. I think this is more of a business decision, on the technical side it works but just not the cleanest. Deferring decision to you @rafegoldberg 🙏

So if we were to go with this and address the ticket, we would need a monorepo side change to set on this new flag for RDMD components in the API Explorer Description Field only, to keep the blast radius low. Now MDX (left) would match legacy / Xish (right)

Screenshot 2026-04-21 at 10 38 14 am

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants