Giter Site home page Giter Site logo

anchorme.js's Introduction

Anchorme.js v0.4.0

Javascript library to convert URLs in text to clickable HTML anchor links.

Features:

  1. Highly sensitive.
  2. Least possible false positives with high sensitivity.
  3. Skips HTML (won't break it if it had a URL as an attribute of some element).
  4. Would make links if they have protocols (eg. http://) or not.
  5. Supports all TLDs in accordance to an up-to-date IANA list.
  6. Also works with IPs, FTPs, and Emails.
  7. Also works when ports defined (eg. mywebsite:80/page.html)
  8. you can set any attribute you want for the resulting elements
  9. Very small in size (14KB).
  10. No regex involved, very readable and maintainable
  11. Higher performance than similar libraries
  12. Tested against Autolinker.js and linkifyjs on FireFox. After 10000 iterations anchorme.js scored 300ms while others where around 1200m.

How to use:

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"});

Test it before using..

Check how this libary would work for you here.

anchorme.js's People

Contributors

ali-saleem avatar elselawi avatar

Watchers

James Cloos avatar Gerardo JT avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.