@tomk79/keywordmarker
v1.0.0
Published
Add markers to keywords in a text.
Downloads
1
Readme
@tomk79/keywordmarker
Add markers to keywords in a text.
Installation
npm install @tomk79/keywordmarker
Usage
import KeywordMarker from '@tomk79/keywordmarker';
const result = KeywordMarker('Includes "KEYWORD" inside.', 'keyword');
// You'll get a HTML `Includes "<mark>KEYWORD</mark>" inside.` as result.
Options
import KeywordMarker from '@tomk79/keywordmarker';
const result = KeywordMarker('Includes "KEYWORD" inside.', 'keyword', {
// The `maxLength` option sets an upper limit on the number of characters in the returned text.
// Default to 120.
maxLength: 120,
// The `sideLength` option sets the maximum number of characters for the text between keywords.
// Default to 15.
sideLength: 15,
});
Change log
@tomk79/keywordmarker v1.0.0 (2024-04-20)
- Initial release.
License
MIT License
Author
Tomoya Koyanagi [email protected]