linkify-gh-usernames

Linkify GitHub usernames

Usage no npm install needed!

<script type="module">
  import linkifyGhUsernames from 'https://cdn.skypack.dev/linkify-gh-usernames';
</script>

README

linkify-gh-usernames Build Status

Linkify GitHub usernames

Install

$ npm install linkify-gh-usernames

Usage

const linkifyUsernames = require('linkify-gh-usernames');

linkifyUsernames('Hi @yeskunall and welcome to the @nisostech 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/nisostech" class="github" target="_blank">@nisostech</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