1.1.0 • Published 7 years ago

social-linkify v1.1.0

Weekly downloads
7
License
-
Repository
github
Last release
7 years ago

social-linkify

Converts inline urls, #hashtags, @mentions, etc. into clickable links. Supports linkifying plain text, or HTML. Works in Node or the browser.

API

The linkify function accepts three arguments:

linkify(string, source, sourceEntities);
  • The text to linkify
  • The name of the source where this content originated
  • Optionally, some entities returned by that source's API (only twitter or facebook at the moment).

The linkify.html function accepts the first two arguments above.

Example

var linkify = require('social-linkify');

// Linkify a tweet with entities from the Twitter API
linkify('Testing #hashtag @username http://google.com/', 'twitter', entities);

// Linkify a Facebook post with message_tags from the Facebook API
linkify('Testing My Page', 'facebook', message_tags);

// Linkify an Instagram post
linkify('Testing #💩', 'instagram');

// Linkify some HTML
linkify.html('Testing http://storify.com <a href="http://google.com/">a link</a>');