Skip to content

fix: prevent grouping consecutive code blocks with the same language#667

Open
okuryu wants to merge 3 commits intonodejs:mainfrom
okuryu:fix/highlighter-same-language-grouping
Open

fix: prevent grouping consecutive code blocks with the same language#667
okuryu wants to merge 3 commits intonodejs:mainfrom
okuryu:fix/highlighter-same-language-grouping

Conversation

@okuryu
Copy link

@okuryu okuryu commented Mar 11, 2026

Two consecutive code blocks with the same language (e.g., both mjs) were incorrectly grouped into a CJS/MJS switchable tab. This adds a check to ensure the two code blocks have different languages before creating a switchable code tab.

Refs: nodejs/node#62181

Two consecutive code blocks with the same language (e.g., both `mjs`)
were incorrectly grouped into a CJS/MJS switchable tab. Add a check
to ensure the two code blocks have different languages before creating
a switchable code tab.

Refs: nodejs/node#62181

Co-authored-by: Copilot <[email protected]>
@okuryu okuryu requested a review from a team as a code owner March 11, 2026 11:34
Copilot AI review requested due to automatic review settings March 11, 2026 11:34
@vercel
Copy link

vercel bot commented Mar 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Mar 11, 2026 2:15pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an issue in the legacy Shiki rehype transformer where consecutive code blocks could be incorrectly grouped into a CJS/MJS toggle even when both blocks use the same language.

Changes:

  • Add a language inequality check before creating a switchable CJS/MJS code tab.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ovflowd ovflowd added the github_actions [Dependabot Only] Pull requests that update GitHub Actions code label Mar 11, 2026
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.88%. Comparing base (6c7b826) to head (8f46e38).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/highlighter.mjs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #667      +/-   ##
==========================================
- Coverage   75.89%   75.88%   -0.02%     
==========================================
  Files         145      145              
  Lines       13728    13722       -6     
  Branches      992      991       -1     
==========================================
- Hits        10419    10413       -6     
  Misses       3303     3303              
  Partials        6        6              

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller avivkeller removed the github_actions [Dependabot Only] Pull requests that update GitHub Actions code label Mar 11, 2026
Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

SGTM!

@ovflowd ovflowd added the github_actions [Dependabot Only] Pull requests that update GitHub Actions code label Mar 11, 2026
@avivkeller avivkeller removed the github_actions [Dependabot Only] Pull requests that update GitHub Actions code label Mar 12, 2026
@avivkeller
Copy link
Member

@ovflowd the GitHub actions label doesn't trigger any actions, it's used by Dependabot

@ovflowd
Copy link
Member

ovflowd commented Mar 12, 2026

Oh lol, used with nodejs.org repo xD

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.

4 participants