Skip to content

fix(mdxish): combine code tabs if separated by CLRF token \r\n#1372

Merged
eaglethrost merged 3 commits intonextfrom
dimas/CX-3027-codetabs-slash-t-broken
Mar 15, 2026
Merged

fix(mdxish): combine code tabs if separated by CLRF token \r\n#1372
eaglethrost merged 3 commits intonextfrom
dimas/CX-3027-codetabs-slash-t-broken

Conversation

@eaglethrost
Copy link
Copy Markdown
Contributor

@eaglethrost eaglethrost commented Mar 12, 2026

PR App Fix CX-3027

🧰 Changes

While investigating CX-3027, I found that one of the cause of the code tabs separating was because the raw document had CLRF new line tokens, so \r\n instead of only \n in between the code blocks. I verified that this resulted in separate code blocks in mdxish rendering, but seems like it's correctly tabbed in legacy from looking at the resulting mdast trees.

The adjacency check in the code-tabs transformer only accounted for LF (\n) line endings. CRLF adds an extra byte (\r) to the offset gap, causing the check to fail and rendering each code block separately. So I updated the check to also accept CRLF by allowing a gap of start.column + 1 when the blocks are still on consecutive lines (i.e., the extra byte is \r, not a blank line)/

🧬 QA & Testing

Unfortunately, it's quite hard to visually test in an actual doc because adding in the \r\n in the raw doc will render it literally, and I read that this might be a Windows os specific thing & not Mac. The best way I can think of is through the jest tests I created, which includes some regression tests.

One regression check is to ensure the code blocks behaviour should follow MDX & legacy, so testing multiple consecutive blocks, adding some space / characters between the blocks, adding more than 1 line space between, etc.

Copy link
Copy Markdown
Contributor

@kevinports kevinports left a comment

Choose a reason for hiding this comment

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

Cloned this PR and the Akamai projects from the ticket and ran locally & confirmed this fixes it.

@eaglethrost eaglethrost merged commit 2d8d267 into next Mar 15, 2026
14 of 15 checks passed
@eaglethrost eaglethrost deleted the dimas/CX-3027-codetabs-slash-t-broken branch March 15, 2026 12:38
rafegoldberg pushed a commit that referenced this pull request Mar 16, 2026
## Version 13.6.0
### ✨ New & Improved

* correctly render block level elements in callout ([#1362](#1362)) ([32040cb](32040cb))

### 🛠 Fixes & Updates

* **mdxish-editor:** built in anchor component not deserializing to to a link in mdxish editor ([#1361](#1361)) ([30e037d](30e037d))
* **mdxish:** callout end tag rendering ([#1373](#1373)) ([cad7594](cad7594))
* **mdxish:** combine code tabs if separated by CLRF token \r\n ([#1372](#1372)) ([2d8d267](2d8d267))
* **mdxish:** Curly braces on separate lines cause render failure on MDXish ([#1364](#1364)) ([d85e106](d85e106))
* **mdxished:** Preserve embed type and dimensions when copy/pasting <Embed> blocks ([#1369](#1369)) ([5af9623](5af9623))

### 📘 Tests & Docs

* **xish:** add CLAUDE.md + processor flow overview docs ([#1370](#1370)) ([b8d9e4c](b8d9e4c))

<!--SKIP CI-->
@rafegoldberg
Copy link
Copy Markdown
Contributor

This PR was released!

🚀 Changes included in v13.6.0

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants