Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blessanm86/tweet-to-html
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.
https://github.com/blessanm86/tweet-to-html
Last synced: 13 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/blessanm86/tweet-to-html
- Owner: blessanm86
- License: mit
- Created: 2015-10-19T17:25:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T18:06:28.000Z (over 1 year ago)
- Last Synced: 2024-04-24T20:28:34.270Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 549 KB
- Stars: 11
- Watchers: 1
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tweet-to-html
[![Build Status](https://travis-ci.org/blessenm/tweet-to-html.svg?branch=master)](https://travis-ci.org/blessenm/tweet-to-html)
[![npm version](https://badge.fury.io/js/tweet-to-html.svg)](https://badge.fury.io/js/tweet-to-html)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.
```
To use with v1 Twitter API, use version 1.1.2
```## 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 arrayvar 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
- Post issues/enhancements in the github issue tracker.
- My email is [email protected]
- Pull requests are welcome.
- [**Follow Me On Twitter**](https://twitter.com/blessanm86 "Follow Me On Twitter")
- [**LinkedIn Pofile**](http://in.linkedin.com/pub/blessan-mathew/24/605/730 "LinkedIn Profie")
- [**Stack Overflow Pofile**](http://stackoverflow.com/users/548568/blessenm "Stack Overflow Pofile")