helior / react-highlighter

:high_brightness: Highlight text using React
MIT License
157 stars 42 forks source link

Add new `matchStyle` property #18

Closed bvaughn closed 8 years ago

bvaughn commented 8 years ago

A lot of React components use inline styles instead of classes. Some of them probably do this because of idealogical reasons but others do it to simplify things for other components.

For example, a Browserify user recently filed a bug against my devtools monitor because Browserify was not able to import the stylesheet (see bvaughn/redux-devtools-filterable-log-monitor/issues/13). To resolve this I decided to inline styles. Unfortunately I could no longer customize the appearance of highlighted tags.

This PR adds that ability along with a unit test. :)

PS Your package.json should list react as a peer dependency because npm i && npm test fails without it. I didn't include that change in this PR though because I wanted to keep it focused. :)

bvaughn commented 8 years ago

Note that npm test passes locally. Not sure what's going on with your Travis instance.

helior commented 8 years ago

Looks good. Thanks @bvaughn!