Javascript library to convert URLs in text to clickable HTML anchor links.
- Highly sensitive.
- Least possible false positives with high sensitivity.
- Skips HTML (won't break it if it had a URL as an attribute of some element).
- Would make links if they have protocols (eg. http://) or not.
- Supports all TLDs in accordance to an up-to-date IANA list.
- Also works with IPs, FTPs, and Emails.
- Also works when ports defined (eg. mywebsite:80/page.html)
- you can set any attribute you want for the resulting elements
- Very small in size (14KB).
- No regex involved, very readable and maintainable
- Higher performance than similar libraries
- Tested against Autolinker.js and linkifyjs on FireFox. After 10000 iterations anchorme.js scored 300ms while others where around 1200m.
A. include the library file in your HTML:
<script type="text/javascript" src="anchorme.min.js"></script>
B. call the method:
var someText = "this is a text with a link www.github.com ..";
var result = anchorme.js(someText);
C. [OPTIONAL] Set any attribute you want like this:
var someText = "this is a text with a link www.github.com ..";
var result = anchorme.js(someText,{"class":"someclassname","id":"someID","target":"_blank", "attribute-name":"attribute-property"});
Check how this libary would work for you here.