Tiny, fast, efficient, feature rich Javascript library to detect links / URLs / Emails in text and convert them to clickable HTML anchor links.
-
Sensitivity: It's Highly sensitive with the least false positives.
- It validates URLs and Emails against full IANA list
- Validates port numbers (if present)
- Validates IP octet numbers (if present)
-
Robustness:
- Skips HTML, so it doesn't break your HTML if it had a URL as an attribute for an element.
- Links with or without protocols.
- Works with IPs, FTPs, Emails and files.
- Can detect parenthesis and quotation marks as part of the URL or as a surrounding to the URL.
- Fast: It's definitely fast! processing H.G. Wells The Time Machine novel with over 1500 URLs inserted at random places takes only 3.5 seconds.
- Light Weight: Although it's a feature rich library with a full IANA list included, it's only 6KB when minified and gzipped.
This project is written in Typescript and compiled to JavaScript.
- Typescript installed globally
- Jest installed globally (for testing)
- Clone this repository
cd anchorme.js && npm install
- ..
- Add unit tests if needed
- Run
npm run test
for testing - Run
npm run build
for building
License: The MIT License (MIT) - Copyright (c) 2017 Alex Corvi