@zestia/ember-twitter-entities
This Ember CLI addon parses Twitter Entities from the Twitter API and renders a them as Ember Components.
Installation
ember install @zestia/ember-twitter-entities
Demo
https://zestia.github.io/ember-twitter-entities/
Notes
- Supported entity types are:
hashtags
,media
,urls
,user_mentions
,symbols
. Basically any entity which has anindices
property and occurs in the tweet text. So this excludespolls
.
Example
Given the following:
entities: {
urls: [{
url: 'https://t.co/emberjs',
display_url: 'emberjs.com',
indices: [6, 17]
}],
hashtags: [],
user_mentions: [],
media: [],
symbols: []
}
The addon will render:
visit <a href="http://t.co/emberjs">emberjs.com</a>
...using the built in components for each entity type.
Customising
You can customise what components are used to render each type of entity:
HTML in tweets
If the tweet you are rendering is already encoded, flag it as html-safe to prevent double encoding.
const tweet = 'This tweet contains <br> HTML';
this.text = htmlSafe(tweet);
Outputs: This tweet contains <br> HTML
Instead of: This tweet contains <br> HTML