包详细信息

tweet-to-html

blessenm34MIT2.0.0

Browser friendly package that converts twitter's API tweet objects text property to HTML. Takes care of all the entities and its links. Handles emoji's.

twitter, tweet, api, html

自述文件

tweet-to-html

Build Status npm version

Browser friendly package that converts twitter's API tweet objects text property to HTML. Takes care of all the entities and its links. Handles emoji's.

Demo

http://blessanm86.github.io/tweet-to-html/

Installation

npm install tweet-to-html -S
yarn add tweet-to-html

Usage

There is only one method named parse. You can pass in a tweet object or an array of objects, and an optional config object. The response will be object/array tweet object with a new property named html with the parsed output.

var tweetToHTML = require('tweet-to-html');

var result  = tweetToHTML.parse(tweetObj); //Single tweet object
var results = tweetToHTML.parse(tweetArr); //Multiple tweets in an array

var photoConfig = {
  photoSize: 'large' // Any size supported by the `media` entity (thumb, small, medium...)
};

var result  = tweetToHTML.parse(tweetObj, photoConfig); //Single tweet object with specified image size

//output
console.log(result.html);
console.log(results[0].html);

Issues Or Contributions

更新日志

1.0.2 (2015-11-12)

Bugfixes:

  • #3 - Urls are now searched with the indices given by the twitter api.

Enhancements:

  • #4 - Now quoted text are also parsed in included in the final output.

1.0.1 (2015-10-27)

Bugfixes:

  • #2 - User mentions with upper/lower case are now handled.

1.0.0 (2015-10-26)

  • Initial release