Skip to content

Commit

Permalink
More detailed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
itay-grudev committed Jan 20, 2016
1 parent d417a28 commit 95de2e5
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
jQuery Text Highlight
=====================

jQuery Text Highlight is a plugin for highlighting words
jQuery Text Highlight is a plugin for highlighting Words, Text or Regular
Expressions within the DOM.

Usage Examples
--------------
Expand All @@ -21,6 +22,7 @@ $('h1').textHighlight(['World', 'World'], {
class: '',
caseSensitive: false
});
$('h1').removeHighlight();
```

Each line will produce the following markup:
Expand All @@ -32,6 +34,35 @@ Each line will produce the following markup:
<h1><mark>Hello</mark> <mark>World</mark></h1>
```

Methods
-------

```javascript
$.fn.textHighlight( term, options )
```

Encapsulates text within a specified element.

* `term` could be either a string, a regular expression or an array of the two.
* `options` is an object containing configuration options. See below for more details.

```javascript
$.fn.removeHighlight();
```

Removes the encapsulation applied by `$.fn.textHighlight`.

Options
-------

|Option | Type | Description |
| ------------- |---------- | ----------- |
| element | `object` | The tag name in which the matched text should be encapsulated.|
| class | `string` | A specific class to be applied on that element. |
| caseSensitive | `boolean` | Whether to ignore the case of the specified keyword/regex. |

_**Note:** The `caseSensitive` option overrides the `i` flag of Regular Expressions._

License
-------
This plugin and the associated documentation are distributed under the terms of
Expand Down

0 comments on commit 95de2e5

Please sign in to comment.