js-text-marker
v0.0.2
Published
Node lib that mark string in a text. It is possible mark the text with html tags.
Downloads
5
Readme
js-text-marker
Javascript lib that mark string in a text. It is possible mark the text with html tags.
Installation
Gemfile
run this line in your prompt
$ npm install text-marker
Usage
var JsTextMarker = require('js-text-marker');
var snippet_to_be_marked = "text";
var text = "Some text to be marked. After used TextMaker in this text " +
"it will return this text with desired text marked.";
var tm_tag1 = new Tag('h1', 'yellow', 'black');
var tm = new JsTextMarker(text);
var text_with_all_ocurrence_of_snipped_marked = tm.mark_all_ocurrence_of(
snippet_to_be_marked, tm_tag1);
var text_with_all_ocurrences_of_snipped_marked = tm.mark_all_ocurrence_of(
snippet_to_be_marked, new Tag(span));
var text_with_first_ocurrence_of_snipped_marked = tm.mark_first_ocurrence_of(
snippet_to_be_marked, new Tag('span', 'yellow'));
Author
Created and maintained by
Geison Felipe Goes Flores
@geisonfgfg
Contributing
- Fork it ( https://github.com/[my-github-username]/text-marker/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
License
TextMarker is licensed under the MIT license.
See LICENSE for the full license text.