npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

autolink.js

v0.1.1

Published

Auto-link url and images

Downloads

884

Readme

autolink.js Build Status

Auto-link url and images, email, video, music, <br/> in text.

Installation

CDN: https://unpkg.com/autolink.js/dist/autolink.min.js

npm install --save autolink.js

Example

import autoLink from 'autolink.js'
// link URL and Images/Emails
// `https?://` is optional
// normal link is transformed to <a>
// image address(png|gif|jpe?g) is transformed to <img>
autoLink(text, {
  // default options:
  email: true,
  image: true,
  // \n to <br/>
  br: true
})
// link URL only
// then it would regard image address as normal link using <a>
// instead of using <img> tag
autoLink(text, {image: false})
// link-ify and add DOM attributes
autoLink(text, {
  // add attributes for image only
  imageAttr: {
    'data-image': true
  },
  // add attributes for link only
  linkAttr: {
    'data-link': true
  },
  // add attributes for both
  sharedAttr: {
    'data-shared': true
  }
})
// show URL path only for normal links
// eg: 'http://github.com' is transformed to
// '<a href="http://github.com">github.com</a>'
// wow, without `http://` in the text
autoLink(text, {removeHTTP: true})
// enable to transform all embedable url
// eg: youtube/kickstarter/cloudmusic
autoLink(text, {
  // enable all
  embed: true,
  // or just enable some of them
  youtube: true,
  kickstarter: true
})
// escape HTML tags, false by default
autoLink(text, {safe: true})

Embed

Feel free to send a PR for supporting more embed-able links.

Now we support:

  • Youtube, eg https://www.youtube.com/watch?v=5vOAxP-u5KA
  • Kickstarter, eg: https://www.kickstarter.com/projects/1546683916/treasures-of-the-universe-unique-astrophotography?ref=home_popular
  • Cloudmusic, eg: http://music.163.com/#/song?id=36103237
  • Youku, eg: http://v.youku.com/v_show/id_XMTQwMDUzODM0MA==.html?f=23710673#paction
  • Vimeo, eg: https://vimeo.com/channels/staffpicks/253396666

License

MIT © EGOIST