Jump To

Linkify #Hashtag Plugin

Adds basic support for Twitter-style hashtags.


Node.js module

Install from the command line with NPM

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

or with ES6 modules

import * as linkify from "linkifyjs";
import "linkify-plugin-hashtag";

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-hashtag.js"></script>


Use the formatHref option with your preferred interface to correctly resolve a hashtag. Example linking to Twitter hashtags with linkifyHtml:

const options = {
  formatHref: {
    hashtag: (href) => "https://twitter.com/hashtag/" + href.substr(1),

// With linkify-html
linkifyHtml("Works with hashtags #PhotoOfTheDay or #일상", options);

// With linkify-react
<Linkify options={options}>Works with hashtags #PhotoOfTheDay or #일상</Linkify>

The last line returns the following string:

'Works with hashtags <a href="https://twitter.com/hashtag/PhotoOfTheDay">#PhotoOfTheDay</a> or <a href="https://twitter.com/hashtag/일상">#일상</a>';