-
Notifications
You must be signed in to change notification settings - Fork 16
fix(stripComments): preserve tabbed code blocks #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 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; | ||
| }, | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
dannobytes
left a comment
There was a problem hiding this 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?
| 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; | ||
| }, | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
yep thats correct |
## 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-->
This PR was released!🚀 Changes included in v11.8.0 |

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

Our
stripCommentsfunction converts md -> mdast, removes comments, then serializes mdast -> md usingremarkStringify-- 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:

So we need to retain this formatting in
stripComments!🧰 Changes
🧬 QA & Testing