Skip to content

Conversation

@kevinports
Copy link
Contributor

PR App Fix CX-2582

Akamai has a rendering issue with broken code tabs when their "Sanitize Comments" flag is enabled
image

Our stripComments function converts md -> mdast, removes comments, then serializes mdast -> md using remarkStringify -- which by default adds one blank line between any two flow (“block”) nodes.

But a feature of our markdown renderer is to take any code blocks flush next to each other and turn them into a tabbed interface:
image

So we need to retain this formatting in stripComments!

🧰 Changes

  • Prevent insert of newline when stringifying sibling code blocks.

🧬 QA & Testing

Comment on lines +40 to +47
join: [
// Preserve tight sibling code blocks without adding extra newlines between them.
// Our markdown renderer uses this to group these code blocks into a tabbed interface.
(left, right) => {
// 0 = no newline between blocks
return (left.type === 'code' && right.type === 'code') ? 0 : undefined;
},
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor

@dannobytes dannobytes left a comment

Choose a reason for hiding this comment

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

so long as that test case passes, lgtm! thanks for the quick fix.

i know we both had a feeling that we'd be incrementally adding more test cases as they come in for these edge-cases.

and this is due to this tabbed feature being another readme-flavored syntax right?

Comment on lines +40 to +47
join: [
// Preserve tight sibling code blocks without adding extra newlines between them.
// Our markdown renderer uses this to group these code blocks into a tabbed interface.
(left, right) => {
// 0 = no newline between blocks
return (left.type === 'code' && right.type === 'code') ? 0 : undefined;
},
],
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@kevinports
Copy link
Contributor Author

and this is due to this tabbed feature being another readme-flavored syntax right?

yep thats correct

@kevinports kevinports merged commit 64e58ce into next Dec 5, 2025
11 checks passed
@kevinports kevinports deleted the CX-2582 branch December 5, 2025 19:07
rafegoldberg pushed a commit that referenced this pull request Dec 5, 2025
## Version 11.8.0
### ✨ New & Improved

* **mdxish:** add new MDXish engine ([#1243](#1243)) ([9e8f85f](9e8f85f)), closes [/github.com//pull/1243#discussion_r2587081529](https://github.com/readmeio//github.com/readmeio/markdown/pull/1243/issues/discussion_r2587081529)

### 🛠 Fixes & Updates

* **stripComments:** preserve tabbed code blocks ([#1250](#1250)) ([64e58ce](64e58ce))

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

This PR was released!

🚀 Changes included in v11.8.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.

4 participants