
Security News
Socket Releases Free Certified Patches for Nuxt Security Vulnerabilities
Socket releases free Certified Patches for high-severity Nuxt vulnerabilities, including server-side remote code execution through server island props.
linkify-it
Advanced tools
Links recognition library with FULL unicode support. Focused on high quality link patterns detection in plain text.
Why it's awesome:
npm install linkify-it --save
import { LinkifyIt } from 'linkify-it';
const linkify = new LinkifyIt({ fuzzyLink: true });
linkify
.tlds(require('tlds'))
.tlds('onion', true)
.add('ftp:', null)
.set({ fuzzyIP: true });
console.log(linkify.test('Site github.com!'));
// true
console.log(linkify.match('Site github.com!'));
// [ {
// schema: "",
// index: 5,
// lastIndex: 15,
// raw: "github.com",
// text: "github.com",
// url: "http://github.com",
// } ]
See more in examples folder:
Creates new linkifier instance.
By default understands:
http(s)://... , ftp://..., mailto:... & //... linksoptions:
http(s):// head. Default false.false.mailto: prefix. Default true.true to terminate link with --- (if it's considered as long dash).
Default false.REBuilder instance for patched regex fragments.false.10000.Searches linkifiable pattern and returns true on success or false on fail.
Similar to .test() but checks only specific protocol tail exactly at given
position. Returns length of found pattern (0 on fail).
Returns Array of found link matches or null if nothing found.
Each match has:
// for
protocol-neutral links.Checks if a match exists at the start of the string. Returns Match
(see docs for match(text)) or null if no URL is at the start.
Doesn't work with fuzzy links.
Load (or merge) new tlds list. Those are needed for fuzzy links (without schema) to avoid false positives. By default:
xn--...) root zones are ok.If that's not enough, you can reload defaults with more detailed zones list.
Add a new schema to the schemas object.
key is a link prefix (usually, protocol name with : at the end, skype:
for example). linkify-it makes sure that prefix is not preceded with
alphanumeric char.
value is a rule to check tail after link prefix:
To disable an existing rule, use .add(key, null).
Override default options. Missed properties will not be changed.
Autolinker is a similar package that automatically converts URLs, email addresses, and Twitter handles into clickable links. It is similar to linkify-it but also includes options to truncate the length of the displayed URLs and to strip prefixes (e.g., 'http://').
url-regex is a package that provides a regular expression for matching URLs. Unlike linkify-it, url-regex does not offer the same level of customization or the ability to add new schemas or TLDs, but it is useful for simple URL matching.
Anchorme is another package that converts URLs and email addresses to clickable links. It offers features like link validation and the ability to convert links within a specific part of the text. It is comparable to linkify-it but with a different API and additional options for link validation.
FAQs
Links recognition library with FULL unicode support
The npm package linkify-it receives a total of 20,889,034 weekly downloads. As such, linkify-it popularity was classified as popular.
We found that linkify-it 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
Socket releases free Certified Patches for high-severity Nuxt vulnerabilities, including server-side remote code execution through server island props.

Security News
An open letter signed by 50 companies, from NVIDIA and Microsoft to Mistral and Hugging Face, urges Washington not to restrict open weight AI.

Security News
/Research
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.