linkify-gh-usernames
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

linkify-gh-usernames

Linkify GitHub usernames

Install

[!NOTE] This package is ESM only.

$ npm install linkify-gh-usernames

Usage

import linkifyUsernames from "linkify-gh-usernames";

linkifyUsernames(
  "Hi @yeskunall and welcome to the @21kb org! Feel free to look around!",
  {
    attributes: {
      class: "github",
      target: "_blank",
    },
  },
);
//=> 'Hi <a href="https://github.com/yeskunall" class="github" target="_blank">@yeskunall</a> and welcome to the <a href="https://github.com/21kb" class="github" target="_blank">@21kb</a> org! Feel free to look around!

API

linkifyUsernames(input, [options])

input

Type: string

Text containing valid GitHub username.

options

Type: Object

attributes

Type: Object

HTML attributes to add to the link.

value

Type: string
Default: The URL

Set a custom HTML value for the link.

Related

Package Sidebar

Install

npm i linkify-gh-usernames

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

5.41 kB

Total Files

5

Last publish

Collaborators

  • yeskunall