Skip to content

Conversation

@saitejacodes
Copy link

Fixes #589

Description

Previously, the notation transformer would unconditionally remove lines that became empty after comment removal, even if those lines were targeted by annotations (e.g., // [code app/Models/InstanceSettings.php highlight]).

This PR modifies the removal logic to check if the line has any CSS classes other than the default line. If it does (meaning it was highlighted, focused, etc.), the line is preserved.

Changes

  • Modified packages/transformers/src/shared/notation-transformer.ts to check for additional classes before removing empty lines.
  • Added a reproduction test case in packages/transformers/test/fixtures/highlight/preserve-empty.js.
  • Updated snapshots.

@netlify
Copy link

netlify bot commented Dec 4, 2025

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit 61f34e5
🔍 Latest deploy log https://app.netlify.com/projects/shiki-next/deploys/6931b7ccf19aff00088bc7ae
😎 Deploy Preview https://deploy-preview-1218--shiki-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 4, 2025

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit 61f34e5
🔍 Latest deploy log https://app.netlify.com/projects/shiki-matsu/deploys/6931b7cc7d2d110008bd6d1c
😎 Deploy Preview https://deploy-preview-1218--shiki-matsu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.20%. Comparing base (28dd090) to head (61f34e5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1218   +/-   ##
=======================================
  Coverage   95.20%   95.20%           
=======================================
  Files          92       92           
  Lines        7922     7925    +3     
  Branches     1689     1690    +1     
=======================================
+ Hits         7542     7545    +3     
  Misses        374      374           
  Partials        6        6           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

[Bug] Notation transfomers remove empty annotated lines

1 participant