LI

Linkifyjs

linkifyjs

Find URLs, email addresses, #hashtags and @mentions in plain-text strings, then convert them into HTML <a> links.

Data Fetching
autolink
email
hashtag
html
jquery
link
mention
react
twitter
url
Stars
1
Weekly
0
Open issues
0
Bundle
~60 kB

Installation

npm install linkifyjs

Code example

import { useLinkifyjs } from "linkifyjs";

export function Example() {
  const { data, isLoading, error } = useLinkifyjs({
    queryKey: ["example"],
    queryFn: () => fetch("/api/example").then((r) => r.json()),
  });

  if (isLoading) return <p>Loading…</p>;
  if (error) return <p>Could not load data.</p>;
  return <pre>{JSON.stringify(data, null, 2)}</pre>;
}

Pros & cons

Pros

  • Actively maintained by Nick Frasser
  • 0 weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~60 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 0 open issues on GitHub

FAQs

Alternatives & similar libraries