Gathering detailed insights and metrics for react-linkify-it
Gathering detailed insights and metrics for react-linkify-it
Gathering detailed insights and metrics for react-linkify-it
Gathering detailed insights and metrics for react-linkify-it
linkify-it
Links recognition library with FULL unicode support
@types/linkify-it
TypeScript definitions for linkify-it
linkifyjs
Find URLs, email addresses, #hashtags and @mentions in plain-text strings, then convert them into HTML <a> links.
linkify-react
React element interface for linkifyjs
npm install react-linkify-it
87.6
Supply Chain
98.6
Quality
75.7
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
53 Stars
152 Commits
3 Forks
1 Watching
11 Branches
2 Contributors
Updated on 26 Nov 2024
Minified
Minified + Gzipped
TypeScript (88.06%)
JavaScript (11.94%)
Cumulative downloads
Total Downloads
Last day
-7.4%
1,843
Compared to previous day
Last week
-0.2%
11,194
Compared to previous week
Last month
8.4%
47,087
Compared to previous month
Last year
9%
541,287
Compared to previous year
1
27
A tiny and dependency free universal linking solution that turns any pattern in your text into clickable links (aka linkify). Supports i18n and emojis.
react-linkify-it
comes with a set of prebuilt components for specific linking needs and a generic component to wrap any pattern with a component.
Prebuilt components for linking:
You can also use the generic component which lets you support your own use case as desired:
react-linkify-it
provides a modern bundle for actively maintained browsers and a larger legacy bundle for older browsers.1npm i react-linkify-it
Every prebuilt component also optionally accepts a className
to attach to the link wrapper
1import { LinkItUrl } from 'react-linkify-it'; 2 3const App = () => ( 4 <div className="App"> 5 <LinkItUrl> 6 <p>"add some link https://www.google.com here"</p> 7 </LinkItUrl> 8 </div> 9); 10
1import { LinkItJira } from 'react-linkify-it'; 2 3const App = () => ( 4 <div className="App"> 5 <LinkItJira domain="https://projectid.atlassian.net"> 6 hello AMM-123 ticket 7 </LinkItJira> 8 </div> 9);
1import { LinkItTwitter } from 'react-linkify-it'; 2 3const App = () => ( 4 <div className="App"> 5 <LinkItTwitter> 6 hello @anantoghosh twitter 7 </LinkItTwitter> 8 </div> 9);
1import { LinkItEmail } from 'react-linkify-it'; 2 3const App = () => ( 4 <div className="App"> 5 <LinkItEmail> 6 hello example@gmail.com email 7 </LinkItEmail> 8 </div> 9);
1import { LinkIt } from 'react-linkify-it'; 2 3const regexToMatch = /@([\w_]+)/; 4 5const App = () => ( 6 <div className="App"> 7 <LinkIt 8 {/* Component to wrap each match with */} 9 component={(match, key) => <a href={match} key={key}>{match}</a>} 10 regex={regexToMatch} 11 > 12 www.google.com<div>hi @anantoghosh</div> 13 </LinkIt> 14 </div> 15); 16
1import { linkIt, UrlComponent } from 'react-linkify-it'; 2 3const regexToMatch = /@([\w_]+)/; 4 5const App = () => { 6 7 const output = linkIt( 8 // Text to be linkified 9 text, 10 // Component to wrap each match with, can be any React component 11 (match, key) => <UrlComponent match={match} key={key} />, 12 regexToMatch 13 ); 14 15 return <div className="App">{output}</div> 16}; 17
Just use more than one component to match multiple patterns.
1import { LinkItEmail, LinkItUrl } from 'react-linkify-it'; 2 3const App = () => ( 4 <div className="App"> 5 <LinkItUrl> 6 <LinkItEmail> 7 hello example@gmail.com https://google.com 8 </LinkItEmail> 9 </LinkItUrl> 10 </div> 11); 12
By default, when you import react-linkify-it
, it will use a modern bundle
meant for browsers which
support RegExp Unicode property escapes.
If you are using babel-preset-env
, or any bundler configuration which uses it (e.g. create-react-app
, vite
) with a
browser which does not support RegExp Unicode property escapes, babel will
transform the code to support the browsers resulting in a larger bundle.
If your setup does not use babel-preset-env
and you would still like to support
older browsers, you can use the legacy bundle by importing:
1import { linkIt, LinkIt } from "react-linkify-it/legacy";
1import { linkIt, LinkIt } from "react-linkify-it/dist/react-linkify-it.legacy.esm.min";
Note: Legacy bundle has a larger file size (~3.4Kb minziped).
An umd build with legacy browser support can be used from Unpkg.
This project was made possible due to the incredible work done on the following projects:
This project is licensed under the MIT License - see the LICENSE file for details.
Hey 👋 If my packages has helped you in any way, consider making a small donation to encourage me to keep contributing. Maintaining good software takes time and effort and for open source developers there is very less incentives to do so. Your contribution is greatly appreciated and will motivate me to continue to support developing my packages which you may have used.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More