Skip to content

charlesfries/ember-text-highlight

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

106 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ember-text-highlight

Build Status Coverage Status Code Climate Greenkeeper badge npm

This addon exposes a simple Ember.Helper that wraps matching parts of a text in a span with a stylable CSS class (mark).

It picks the algorithm that likely performs best in the current environment, making it up to twice as fast as the idiomatic implementation with regular expressions.

Ember Text Highlight Demo (2MB)

Compatibility

  • Ember.js v3.20 or above
  • Ember CLI v3.20 or above
  • Node.js v12 or above

Installation

ember install @charlesfries/ember-text-highlight

Usage

{{text-highlight this.content query=this.query}}

Lets say content is Bryan Burke and query is Bry:

{{text-highlight "Bryan Burke" query="bry"}}

The rendered HTML will look like this:

<span class="mark">Bry</span>an Burke

You can now style the CSS class .mark according to your wishes and context.

A good start might be the style you see in the demo video above:

.mark {
  padding: 0 !important;
  background-color: rgba(255, 238, 115, 0.59);
}

Twitter Bootstrap already ships a pre-styled .mark class.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

About

Simple, performant Ember.Helper that highlights matching parts of a text.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 79.2%
  • HTML 7.2%
  • Shell 5.3%
  • Handlebars 5.1%
  • CSS 3.2%