Highlight select fragments of a string using an HTML element and/or a class.
npm install react-highlighter --save
var Highlight = require('react-highlighter');
<Highlight search="brown">The quick brown fox jumps over the lazy dog</Highlight>
search
: The string of text (or Regular Expression) to highlightcaseSensitive
: Determine whether string matching should be case-sensitive. Not applicable to regular expression searches. Defaults tofalse
matchElement
: HTML tag name to wrap around highlighted text. Defaults tostrong
matchClass
: HTML class to wrap around highlighted text. Defaults tohighlight
matchStyle
: Custom style for the match element around highlighted text.
Using Mocha/Chai/React.addons.TestUtils for testing.
npm test
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.