1.0.0 • Published 1 year ago

@tomk79/keywordmarker v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@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 &quot;<mark>KEYWORD</mark>&quot; 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 tomk79@gmail.com

1.0.0

1 year ago