solid-links
v0.3.4
Published
Transform URLs in strings to actual links.
Downloads
10
Readme
Transform URLs in strings to actual links. It will find valid links in the given string and create <a>
tags for it.
Internally, it uses this Regex to identify links.
Table of Contents
Installation
This library is available through the npm registry.
NPM
$ npm -i solid-links
Yarn
$ yarn add solid-links
Setup
Start using it by importing the library first.
CommonJS
const Linkify = require('solid-links');
or
ES6
import Linkify from 'solid-links';
Usage
import Linkify from 'solid-links';
const TEST_STRING = `
Will match the following cases
http://www.foufos.gr
https://www.foufos.gr
http://foufos.gr
http://www.foufos.gr/kino
http://werer.gr
www.foufos.gr
www.mp3.com
www.t.co
http://t.co
http://www.t.co
https://www.t.co
www.aa.com
http://aa.com
http://www.aa.com
https://www.aa.com
Will NOT match the following
www.foufos
www.foufos-.gr
www.-foufos.gr
foufos.gr
http://www.foufos
http://foufos
www.mp3#.com
`;
export default function Sample() {
return (
<Linkify
text={TEST_STRING}
style="text-decoration: underline; color: blue;"
/>
);
}
Authors
- Prince Neil Cedrick Castro - Initial work
See also the list of contributors who participated in this project.