0.0.92 • Published 9 years ago

em-highlight v0.0.92

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

EM Highlight

Looks for given words or expressions in a text and highlights them with <em class='highlight'> TERM </em>

Usage

var highlight = require('em-highlight');

var text   = "We cannot rule this rule out on other rules and there is no stopping.";
var lookup = [
    "rule",
    "rule out"
];

var result = highlight.find(text, lookup);

// "We cannot <em class='highlight'> rule </em> this
//  <em class='highlight'> <em class='highlight'> rule </em> out </em> on other
//  rules and there is no stopping."

Notes

  • Allows case insensitive matching.
  • Not extensively tested with very large texts.
  • Nested lookup terms are highlighted again. You could use css opacity to display this.
0.0.92

9 years ago

0.0.91

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago