# API to highlight any text, no inserting HTML tag

**URL:** <https://discourse.mozilla.org/t/api-to-highlight-any-text-no-inserting-html-tag/87196>\
**Category:** Development\
**Created:** [October 12, 2021, 10:56am UTC](https://discourse.mozilla.org/t/api-to-highlight-any-text-no-inserting-html-tag/87196 "2021-10-12T10:56:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garym](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@garym](https://discourse.mozilla.org/u/garym)\
**Post date:** [October 12, 2021, 10:56am UTC](https://discourse.mozilla.org/t/api-to-highlight-any-text-no-inserting-html-tag/87196/1 "2021-10-12T10:56:46Z")

</div>

I think such API will be useful for:

- TTS Addons
- Note taking addons

Current solusions used by some addons is adding `<span>`:

```auto
<p>Shall I compare thee to summer' s day
Thou art more lovely and more temperate . </p>

```

```auto
<p>Shall I compare thee to summer' s day
<span>Thou art</span> more lovely and more temperate . </p>

```

That works but may cause web broken.

---

<div class="post-metadata">

**Author:** ![jscher2000](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/jscher2000/32/28202_2.png) [@jscher2000](https://discourse.mozilla.org/u/jscher2000)\
**Post date:** [October 12, 2021, 6:54pm UTC](https://discourse.mozilla.org/t/api-to-highlight-any-text-no-inserting-html-tag/87196/2 "2021-10-12T18:54:54Z")

</div>

The built-in Find feature, and the Firefox-only [Find API](https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/find), have this superpower, but of course they cannot highlight the results of multiple queries simultaneously. I wonder how difficult it would be to do this? (I have no idea how it works…)
