Skip to content

Conversation

@sealer3
Copy link
Contributor

@sealer3 sealer3 commented Aug 4, 2025

Description

This PR makes it easy to highlight entire lines without needing to know their lengths. This is achieved by allowing negative character positions in OffsetOrPosition: -1 denotes the end of the line, -2 is the character before, etc.

Linked Issues

#1038

Additional context

Sometimes, you have line numbers that you want to highlight or transform. This change means that applications using Shiki will not need to do manual line length calculations, which Shiki already does.

This is my first contribution to the project. Maintainers, feel free to make edits, and I'd be happy to make changes as needed. I added an additional test case to the transformer tests which covers this change.

@netlify
Copy link

netlify bot commented Aug 4, 2025

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit 1f6bec5
🔍 Latest deploy log https://app.netlify.com/projects/shiki-next/deploys/68905f1c9523b5000805bd8b
😎 Deploy Preview https://deploy-preview-1051--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 Aug 4, 2025

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit 1f6bec5
🔍 Latest deploy log https://app.netlify.com/projects/shiki-matsu/deploys/68905f1c1f3f540008c6050c
😎 Deploy Preview https://deploy-preview-1051--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.

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.

2 participants