Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-highlighter

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-highlighter

Highlight select fragments of texts

  • 0.4.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm version Build Status Coverage Status

react-highlighter

Highlight select fragments of a string using an HTML element and/or a class.

Installation

npm install react-highlighter --save

Usage

var Highlight = require('react-highlighter');

<Highlight search="brown">The quick brown fox jumps over the lazy dog</Highlight>

Props

  • search: The string of text (or Regular Expression) to highlight
  • caseSensitive: Determine whether string matching should be case-sensitive. Not applicable to regular expression searches. Defaults to false
  • ignoreDiacritics: Determine whether string matching should ignore diacritics. Defaults to false
  • diacriticsBlacklist: These chars are treated like characters that don't have any diacritics. Not applicable ignoreDiacritics is false. Defaults to none
  • matchElement: HTML tag name to wrap around highlighted text. Defaults to mark
  • matchClass: HTML class to wrap around highlighted text. Defaults to highlight
  • matchStyle: Custom style for the match element around highlighted text.

Development

Testing

Using Mocha/Chai/React.addons.TestUtils for testing.

npm test

Code Coverage

Generate a report using Istanbul to make sure your tests are touching everything! FYI, Travis will fail the build if there isn't at least 90% of statement coverage and 100% function coverage.

npm run coverage

Coveralls.io integration requires that the environment variable COVERALLS_REPO_TOKEN is set.

Keywords

FAQs

Package last updated on 28 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc