Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

linkify-issues

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linkify-issues

Linkify GitHub issue references

Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
731
365.61%
Maintainers
1
Weekly downloads
 
Created
Source

linkify-issues Build Status

Linkify GitHub issue references

Install

$ npm install linkify-issues

Usage

const linkifyIssues = require('linkify-issues');

linkifyIssues('Fixes #143 and avajs/ava#1023', {
	user: 'sindresorhus',
	repository: 'dofle',
	attributes: {
		class: 'unicorn',
		multiple: ['a', 'b'],
		number: 1,
		exclude: false,
		include: true
	}
});
//=> 'Fixes <a href="https://github.com/sindresorhus/dofle/issues/143" class="unicorn" multiple="a b" number="1" include>#143</a> and <a href="https://github.com/avajs/ava/issues/1023" class="unicorn" multiple="a b" number="1" include>avajs/ava#1023</a>'

const fragment = linkifyUrls('See #143', {
	user: 'sindresorhus',
	repository: 'dofle',
	type: 'dom',
	attributes: {
		class: 'unicorn',
	}
});
document.body.appendChild(fragment);

API

linkifyIssues(string, [options])

string

Type: string

String with issue references to linkify.

options

Type: object

user

Type: string

GitHub user.

repository

Type: string

GitHub repository.

attributes

Type: object

HTML attributes to add to the link.

baseUrl

Type: string
Default: 'https://github.com'

Base URL.

type

Type: string
Values: 'string' 'dom'
Default: 'string'

Format of the generated content.

'string' will return it as a flat string like 'See <a href="https://github.com/sindresorhus/dofle/issue/143">#143</a>'.

'dom' will return it as a DocumentFragment ready to be appended in a DOM safely, like DocumentFragment(TextNode('See '), HTMLAnchorElement('#143')). This type only works in the browser.

  • issue-regex - Regular expression for matching issue references
  • linkify-urls - Linkify URLs in text

License

MIT © Sindre Sorhus

Keywords

issue

FAQs

Package last updated on 18 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts