social-linkify

1.1.0 • Public • Published

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>');

Readme

Keywords

none

Package Sidebar

Install

npm i social-linkify

Weekly Downloads

2

Version

1.1.0

License

none

Last publish

Collaborators

  • devongovett