shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
highlightText
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.string
This function allows you to highlight some text in a string or in an HTMLElement
Params
- ctx*-String|HTMLElement
The string or HTMLElement in which to highlight the text
- search*-String|String[]|RegExp
The text to highlight
Return
- -String|HTMLElement
The processed string or HTMLElement
Example
import { highlightText } from '@blackbyte/sugar/string';
highlightText('Hello world', 'llo'); // => He<span class="-highlight">llo</span> worldTodo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space