Jump To

Linkify Keyword Plugin

Adds support for detecting arbitrary words and highlighting them as links.


Node.js module

Install from the command line with NPM

npm install linkifyjs linkify-plugin-keyword
const linkify = require("linkifyjs");
const linkifyRegisterKeywords = require("linkify-plugin-keyword");

or with ES6 modules

import * as linkify from "linkifyjs";
import linkifyRegisterKeywords from "linkify-plugin-keyword";

Browser globals

Download linkify and extract the contents into your website’s assets directory. Include the following scripts in your HTML:

<script src="linkify.js"></script>
<script src="linkify-plugin-keyword.js"></script>


Register keywords by providing linkifyRegisterKeywords with an array of keywords to highlight:

linkifyRegisterKeywords(["100%", "linkify", "okrs", "roi", "synergy"]);

Format with a linkify inteface:

const options = {
  formatHref: {
    keyword: (keyword) => "/tags/" + keyword.toLowerCase(),

// With linkify-html
  "Use Linkify to complete your OKRs, increase ROI by 100% and create *synergy*",

// With linkify-react
<Linkify options={options}>Use Linkify to complete your OKRs, increase ROI by 100% and create *synergy*</Linkify>

Returns the following string:

'Use <a href="/tags/linkify">Linkify</a> to complete your <a href="/tags/okrs">OKRs</a>, increase <a href="/tags/roi">ROI</a> by <a href="/tags/100%">100%</a> and create *<a href="/tags/synergy">synergy</a>*'