Skip to content
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

feat(kcodeblock): support line highlight syntax #2558

Merged
merged 5 commits into from
Jan 8, 2025

Conversation

Justineo
Copy link
Contributor

@Justineo Justineo commented Jan 7, 2025

Summary

KM-886
KHCP-14552

This PR:

  1. Introduces support for line highlighting syntax (e.g., "2,4,6-12") for the <KCodeBlock> component’s highlighted-line-numbers prop. I recommend using this approach over arrays, as primitive values are less likely to trigger unnecessary re-renders. This is particularly advantageous compared to binding array literals like :highlighted-line-numbers="[2, 4, 6]".

  2. Improves the line navigation behavior to prevent scrolling each time the “Next match” or “Previous match” button is clicked, which reduce the pain for consecutive clicks.

  3. Enhances line matching performance, particularly when dealing with multiple matches for a lengthy section of code.

@Justineo Justineo marked this pull request as ready for review January 7, 2025 08:59
@Justineo Justineo requested review from adamdehaven, jillztom and a team as code owners January 7, 2025 08:59
Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for kongponents-sandbox ready!

Name Link
🔨 Latest commit ef763b1
🔍 Latest deploy log https://app.netlify.com/sites/kongponents-sandbox/deploys/677de09f3aef2100087871aa
😎 Deploy Preview https://deploy-preview-2558--kongponents-sandbox.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 site configuration.

Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for kongponents ready!

Name Link
🔨 Latest commit ef763b1
🔍 Latest deploy log https://app.netlify.com/sites/kongponents/deploys/677de09f6dd9820008be2f9d
😎 Deploy Preview https://deploy-preview-2558--kongponents.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 site configuration.

@Justineo Justineo enabled auto-merge (squash) January 7, 2025 09:07
Copy link
Collaborator

@kaiarrowood kaiarrowood left a comment

Choose a reason for hiding this comment

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

I know it would be a breaking change, but is there still value in supporting an array of numbers if we also support passing a string that can do the same thing? I think I'm the only one currently using this functionality, I'm not sure continuing to maintain support for arrays makes sense.

@adamdehaven
Copy link
Member

I know it would be a breaking change, but is there still value in supporting an array of numbers if we also support passing a string that can do the same thing? I think I'm the only one currently using this functionality, I'm not sure continuing to maintain support for arrays makes sense.

I think changing the implementation as in this PR is ideal, and we can just update your usage once merged? Allowing ranges (and using the standard format) is ideal

@Justineo
Copy link
Contributor Author

Justineo commented Jan 7, 2025

If you already have an array derived from some computation, I think there’s no need to convert it back into a string.

Copy link
Member

@adamdehaven adamdehaven left a comment

Choose a reason for hiding this comment

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

lgtm

@Justineo Justineo merged commit 91a6031 into main Jan 8, 2025
10 checks passed
@Justineo Justineo deleted the feat/codeblock-line-highlight-syntax branch January 8, 2025 15:02
kongponents-bot pushed a commit that referenced this pull request Jan 8, 2025
# [9.16.0](v9.15.0...v9.16.0) (2025-01-08)

### Features

* **kcodeblock:** support line highlight syntax ([#2558](#2558)) ([91a6031](91a6031))
@kongponents-bot
Copy link
Collaborator

🎉 This PR is included in version 9.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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