
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
linkify-react
Advanced tools
The linkify-react npm package is a React component for converting plain text containing URLs, email addresses, and hashtags into clickable links. It is useful for dynamically rendering user-generated content where such elements need to be identified and converted into interactive links.
Convert URLs to clickable links
This feature allows you to convert plain text URLs into clickable links. The `defaultProtocol` option ensures that URLs without a specified protocol are treated as HTTPS links.
import React from 'react';
import Linkify from 'linkify-react';
const options = {
defaultProtocol: 'https'
};
const text = 'Check out this website: www.example.com';
const App = () => (
<Linkify options={options}>{text}</Linkify>
);
export default App;
Convert email addresses to mailto links
This feature converts plain text email addresses into clickable mailto links, making it easy for users to send emails directly from the rendered content.
import React from 'react';
import Linkify from 'linkify-react';
const text = 'Contact us at support@example.com';
const App = () => (
<Linkify>{text}</Linkify>
);
export default App;
Convert hashtags to clickable links
This feature converts hashtags into clickable links. The `formatHref` option allows you to customize the URL format for hashtags, such as linking to a Twitter search for the hashtag.
import React from 'react';
import Linkify from 'linkify-react';
const options = {
formatHref: (href, type) => {
if (type === 'hashtag') {
return 'https://twitter.com/hashtag/' + href.substring(1);
}
return href;
}
};
const text = 'Follow the conversation at #example';
const App = () => (
<Linkify options={options}>{text}</Linkify>
);
export default App;
react-linkify is a similar package that also converts URLs, email addresses, and hashtags in plain text into clickable links. It is simpler and more lightweight compared to linkify-react, but it may lack some of the advanced customization options available in linkify-react.
react-autolinker is another package that provides similar functionality by converting URLs, email addresses, and phone numbers into clickable links. It uses the Autolinker.js library under the hood and offers a range of customization options. It is comparable to linkify-react in terms of features and flexibility.
Linkify React component. Walks through its children and replaces strings containing URLs with strings and <a> elements.
Install from the command line with NPM
npm install linkifyjs linkify-react
Import into your JavaScript with require
const Linkify = require('linkify-react');
or with ES modules
import Linkify from 'linkify-react';
v3.0.0
linkify-react
,linkify-jquery
and linkify-element
respectively:class="linkified"
from all discovered links. Opt back in by setting the className
option:
linkifyStr(str, { className: 'linkified' });
target="_blank"
attribute for discovered URLs. Opt back in by setting the target
option:
linkifyHtml(str, {
target: (href, type) => type === 'url' && '_blank',
});
<span>
tag wrapper in favour of tag-less React.Fragment
for React >=16. To opt back-in, set tagName='span'
:
<Linkify tagName="span">{content}</Linkify>
linkify-string
and linkify-html
instead of linkifyjs/string
and linkifyjs/html
. The embedded packages will be removed in v4.0linkify-plugin-[PLUGIN]
instead of linkifyjs/plugin/[PLUGIN]
. The embedded packages will be removed in v4.0Full Internationalized Domain (IDN) and Emoji domain support πΊπ³πβοΈππ! Detect URLs, #hashtags and @mentions in any language
~10x faster startup; ~4x faster combined startup + first run
Custom protocols with linkify.registerCustomProtocol('protocol')
Modernized codebase and build system
Add new rel
option at top level as an alternate way of including it in attributes
New and improved plugin API
TypeScript definitions included in published packages
linkify.find()
output includes start and end indexes for where in the string a link was found
Plugins no longer need to be called on linkify after import
// Before
import * as linkify from 'linkifyjs';
import hashtag from 'linkifyjs/plugins/hashtag';
hashtag(linkify);
// After
import * as linkify from 'linkifyjs';
import 'linkifyjs/plugins/hashtag';
FAQs
React element interface for linkifyjs
The npm package linkify-react receives a total of 308,040 weekly downloads. As such, linkify-react popularity was classified as popular.
We found that linkify-react 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.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.