matched-highlight

1.0.2 • Public • Published

matched-highlight help us match text to raw html string.

Get started

npm i matched-highlight

Demo

const highlight = require("matched-highlight")

// default: highlight(query, text, opts = { tag: "strong", consecutive: false })

highlight("thin", "this is a thin text on input.")
// => '<strong>thi</strong>s is a thi<strong>n</strong> text on input.'

highlight("thin", "this is a thin text on input.", { consecutive: true })
// => 'this is a <strong>thin</strong> text on input.'

highlight("thin", "this is a thin text on input.", { tag: "b", consecutive: true })
// => 'this is a <b>thin</b> text on input.'

Readme

Keywords

none

Package Sidebar

Install

npm i matched-highlight

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

3.87 kB

Total Files

4

Last publish

Collaborators

  • quetoiohue