parseAlgoliaHitHighlight
Returns the highlighted parts of an Algolia hit.
The parseAlgoliaHitHighlight
function lets you parse the highlighted parts of an Algolia hit.
note
If you're using autocomplete-js
, all Algolia utilities are available directly in the package with the right user agents and the virtual DOM layer. You don't need to import the preset separately.
#
InstallationFirst, you need to install the preset.
Then import it in your project:
If you don't use a package manager, you can use a standalone endpoint:
#
Examples#
With a single string#
With nested attributes#
Parametershit
#
AlgoliaHit
| required
The Algolia hit whose attribute to retrieve the highlighted parts from.
attribute
#
string | string[]
| required
The attribute to retrieve the highlighted parts from. You can use the array syntax to reference nested attributes.
#
Returns
ParsedAttribute[]
An array of the parsed attribute's parts.