Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 452 Bytes

Readme.md

File metadata and controls

24 lines (15 loc) · 452 Bytes

string-highlight

add specified tags to matching all substr instances within a string

Installation

Install with component(1):

$ component install bmcmahen/string-highlight

Example

var el = document.getElementById('bold-me');
var str = el.innerText;
var highlight = require('string-highlight');
var altered = highlight(str, 'ben', '<b>', '</b>');
el.innerHTML = altered;

License

MIT