Linkify GitHub usernames
[!NOTE] This package is ESM only.
$ npm install linkify-gh-usernames
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!
Type: string
Text containing valid GitHub username.
Type: Object
Type: Object
HTML attributes to add to the link.
Type: string
Default: The URL
Set a custom HTML value for the link.
- linkify-issues - Linkify GitHub issue references
- linkify-urls - Linkify URLs in text