-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(algolia): add doc for highlighting utils
- Loading branch information
1 parent
a70f80d
commit 00e2227
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
id: reverseSnippetAlgoliaHit | ||
--- | ||
|
||
Highlights and escapes the non-matching parts of an Algolia hit snippet. | ||
|
||
This function can be used to display the differences of a hit match. | ||
|
||
# Example | ||
|
||
```js | ||
import { reverseSnippetAlgoliaHit } from '@algolia/autocomplete-preset-algolia'; | ||
|
||
const hit = {}; // fetch an Algolia hit | ||
const reverseSnippetedAlgoliaHit = reverseSnippetAlgoliaHit({ | ||
hit, | ||
attribute: 'query', | ||
}); | ||
``` | ||
|
||
# Reference | ||
|
||
## Params | ||
|
||
### `hit` | ||
|
||
> `AlgoliaHit` | required | ||
The Algolia hit to retrieve the attribute value from. | ||
|
||
### `attribute` | ||
|
||
> `string` | required | ||
The attribute to retrieve the reverse snippet value from. | ||
|
||
### `highlightPreTag` | ||
|
||
> `string` | defaults to `<mark>` | ||
The HTML tag to prefix the value with. | ||
|
||
### `highlightPostTag` | ||
|
||
> `string` | defaults to `</mark>` | ||
The HTML tag to suffix the value with. | ||
|
||
### `ignoreEscape` | ||
|
||
> `string[]` | defaults to `[]` | ||
The characters to skip from escaping. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters