0.0.92 • Published 10 years ago

em-highlight v0.0.92

Weekly downloads
7
License
MIT
Repository
github
Last release
10 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

10 years ago

0.0.91

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago