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: Add unhighlightTag prop #99

Merged
merged 7 commits into from
Apr 18, 2022
Merged

feat: Add unhighlightTag prop #99

merged 7 commits into from
Apr 18, 2022

Conversation

kaungmyatlwin
Copy link
Contributor

@kaungmyatlwin kaungmyatlwin commented Mar 8, 2022

Description

This PR adds ability to render custom HTML tags / React Nodes instead of defaulting to <span> element.

Problem

Defaulting to <span> is a good idea and must have, but sometimes we have edge cases where you need to pass custom React nodes in order to provide additional functionalities. Please see the Use Case below.

Use Case

Should be able to render <a> tags whenever necessary or pass React components (such as <Linkify>: https://github.com/tasti/react-linkify) to render the links properly.

Copy link
Collaborator

@sergei-startsev sergei-startsev left a comment

Choose a reason for hiding this comment

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

@kaungmyatlwin Thanks for your contribution. I like the idea to have consistent highlight* and unhighlight* properties. Left a comment.

src/Highlighter.test.js Show resolved Hide resolved
@kaungmyatlwin kaungmyatlwin changed the title feat: Add unhighlightedTag prop feat: Add unhighlightTag prop Apr 6, 2022
@kaungmyatlwin
Copy link
Contributor Author

Hi @sergei-startsev , thanks for replying. I've added two test cases f8d34a1 for unhighlightTag to test if they can be functional/class component.

Please have a look.

Copy link
Collaborator

@sergei-startsev sergei-startsev left a comment

Choose a reason for hiding this comment

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

@kaungmyatlwin please exclude package-lock.json, yarn.lock from the PR.

@kaungmyatlwin
Copy link
Contributor Author

@sergei-startsev Rebased against master. Can you check?

@sergei-startsev sergei-startsev merged commit 95ae076 into bvaughn:master Apr 18, 2022
@sergei-startsev
Copy link
Collaborator

@kaungmyatlwin your changes will be included into the next release.

@kaungmyatlwin kaungmyatlwin deleted the unhilightedTag branch April 19, 2022 04:59
@JeffreyATW
Copy link

@sergei-startsev Hi there! Would you mind creating a new release with this change? Thanks!

@sergei-startsev
Copy link
Collaborator

@JeffreyATW check out https://www.npmjs.com/package/react-highlight-words/v/0.20.0

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.

3 participants