keyword-mark-element

Simple web component to mark keywords in a string

Usage no npm install needed!

<script type="module">
  import keywordMarkElement from 'https://cdn.skypack.dev/keyword-mark-element';
</script>

README

<keyword-mark>

A simple web component to mark keywords in a string.

Demo

Usage

Install:

$ npm i -S keyword-mark-element

Include:

<script src="node_modules/keyword-mark-element/lib/keyword-mark.js"></script>

Or in JavaScript:

import "./node_modules/keyword-mark-element/lib/keyword-mark.js";

Use:

<keyword-mark keywords="foo">foo bar baz</keyword-mark>

Essentially, any keywords specified in the keywords attribute will be highlighted in the text content of the element.

License

MIT