-
Notifications
You must be signed in to change notification settings - Fork 24
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): add highlighted line numbers prop #2555
Conversation
✅ Deploy Preview for kongponents-sandbox ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kongponents ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Can you please update the sandbox page as well with an example for the new prop, as well as enabling search at the same time? How does the component respond if line numbers are passed in and search is also available?
I will update the sandbox 👍🏻 , this is setting the "initial" highlighted lines. If you enable search too your default highlighted lines will be overridden by your search results. I'll update the docs |
Co-authored-by: Adam DeHaven <2229946+adamdehaven@users.noreply.github.com>
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.
lgtm
# [9.15.0](v9.14.30...v9.15.0) (2025-01-03) ### Features * **kcodeblock:** add highlighted line numbers prop ([#2555](#2555)) ([fdfb16a](fdfb16a))
🎉 This PR is included in version 9.15.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
||
An array of line numbers to initially highlight in the code block. | ||
|
||
If search is enabled, matching results will be highlighted in place of the provided line numbers, and all highlighted lines will be cleared once the search query is cleared. |
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.
Why do we need to cancel line highlighting when the query is cleared? I think it's better to emit an event for this and let users to decide whether to cancel line highlighting.
id="code-block-highlight" | ||
:code="code" | ||
language="json" | ||
:highlighted-line-numbers="[2,4,6]" |
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.
Tracking in https://konghq.atlassian.net/browse/KHCP-14552
Summary
Add new
highlightedLineNumbers
prop to manually set highlighting without requiring search.