---
title: 'Liquid filters: highlight'
description: >-
  Wraps all instances of a specific string, within a given string, with an HTML
  `<strong>` tag with a `class` attribute

  of `highlight`.
source_url:
  html: 'https://shopify.dev/docs/api/liquid/filters/highlight'
  md: 'https://shopify.dev/docs/api/liquid/filters/highlight.md'
api_name: liquid
---

# highlight

```oobleck
string | highlight: string
```

returns [string](https://shopify.dev/docs/api/liquid/basics#string)

Wraps all instances of a specific string, within a given string, with an HTML `<strong>` tag with a `class` attribute of `highlight`.

##### Code

```liquid
{% for item in search.results %}
  {% if item.object_type == 'product' %}
    {{ item.description | highlight: search.terms }}
  {% else %}
    {{ item.content | highlight: search.terms }}
  {% endif %}
{% endfor %}
```

##### Data

```json
{
  "search": {
    "results": [
      {
        "description": "This is a love potion.",
        "object_type": "product"
      }
    ],
    "terms": "love"
  }
}
```

##### Output

```html
This is a <strong class="highlight">love</strong> potion.
```
