Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
The linkifyjs package is a robust tool for finding links in plain text and converting them into clickable HTML hyperlinks. It is useful for enhancing user-generated content where links are not automatically hyperlinked.
Link Detection
Detects URLs and email addresses in plain text and provides details about them. This feature is useful for applications that need to extract hyperlink information from text.
const linkify = require('linkifyjs');
const text = 'Visit http://example.com for more info.';
const html = linkify.find(text);
console.log(html);
Convert Text to HTML
Converts plain text containing URLs or email addresses into HTML with clickable links. This is particularly useful for rendering user-generated content safely in web applications.
const linkifyHtml = require('linkifyjs/html');
const text = 'See more at http://example.com.';
const linkedText = linkifyHtml(text);
console.log(linkedText);
Like linkifyjs, autolinker is also designed to automatically convert URLs, email addresses, and Twitter usernames into clickable links in text. It offers additional features like customizing how links are displayed, which might be advantageous depending on the use case.
Linkify is a small yet comprehensive JavaScript plugin for finding URLs in plain-text and converting them to HTML links. It works with all valid URLs and email addresses.
Jump to
Download the latest release, or install via NPM
npm install linkifyjs
or Bower
bower install linkifyjs
Add linkify and linkify-jquery to your HTML following jQuery:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="linkify.min.js"></script>
<script src="linkify-jquery.min.js"></script>
$('p').linkify();
$('#sidebar').linkify({
target: "_blank"
});
linkify.find('Any links to github.com here? If not, contact test@example.com');
Returns the following array
[
{
type: 'url',
value: 'github.com',
href: 'http://github.com'
},
{
type: 'email',
value: 'test@example.com',
href: 'mailto:test@example.com'
}
]
var linkify = require('linkifyjs');
require('linkifyjs/plugin/hashtag')(linkify); // optional
var linkifyStr = require('linkifyjs/string');
linkifyStr('The site github.com is #awesome.', {
defaultProtocol: 'https'
});
Returns the following string
'The site <a href="https://github.com">github.com</a> is <a href="#awesome">#awesome</a>.'
<script src="r.js"></script>
<script src="linkify.amd.js"></script>
<script src="linkify-plugin-hashtag.amd.js"></script> <!-- optional -->
<script src="linkify-element.amd.js"></script>
require(['linkify'], function (linkify) {
linkify.test('github.com'); // true
linkify.test('github.com', 'email'); // false
});
require(['linkify-element'], function (linkifyElement) {
// Linkify the #sidebar element
linkifyElement(document.getElementById('sidebar'), {
linkClass: 'my-link'
});
// Linkify all paragraph tags
document.getElementsByTagName('p').map(linkifyElement);
});
Note that if you are using linkify-jquery.amd.js
, a jquery
module must be defined.
<script src="jquery.js"></script>
<script src="linkify.js"></script>
<script src="linkify-string.js"></script>
<script src="linkify-jquery.js"></script>
linkify.test('dev@example.com'); // true
var htmlStr = linkifyStr('Check out soapboxhq.com it is great!');
$('p').linkify();
Download the latest release
linkify (required)
.min.js
· .js
· .amd.min.js
· .amd.js
Plugins (optional)
.min.js
· .js
· .amd.min.js
· .amd.js
Interfaces (recommended - include at least one)
.min.js
· .js
· .amd.min.js
· .amd.js
.min.js
· .js
· .amd.min.js
· .amd.js
.min.js
· .js
· .amd.min.js
· .amd.js
View full documentation at soapbox.github.io/linkifyjs/docs/.
The core linkify library (excluding plugins) attempts to find emails and URLs that match RFC specifications. However, it doesn't always get it right.
Here are a few of the known issues.
@
.Check out CONTRIBUTING.md.
MIT
Linkify is built with Love™ and maintained by SoapBox Innovations.
FAQs
Find URLs, email addresses, #hashtags and @mentions in plain-text strings, then convert them into HTML links.
The npm package linkifyjs receives a total of 800,390 weekly downloads. As such, linkifyjs popularity was classified as popular.
We found that linkifyjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.