How to use the twitter-text.htmlEscape function in twitter-text

To help you get started, we’ve selected a few twitter-text examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / twitter-text / twitter-text-tests.ts View on Github external
import * as twitter from "twitter-text";

const text: string = twitter.htmlEscape("@you #hello < @world > https://github.com");
const entities = twitter.extractEntitiesWithIndices(text);

function isHashtagEntity(e: twitter.EntityWithIndices): e is twitter.HashtagWithIndices {
    return "hashtag" in e;
}

function isUrlEntity(e: twitter.EntityWithIndices): e is twitter.UrlWithIndices {
    return "url" in e;
}

function isMentionEntity(e: twitter.EntityWithIndices): e is twitter.MentionWithIndices {
    return "screenName" in e;
}

function isCashtagEntity(e: twitter.EntityWithIndices): e is twitter.CashtagWithIndices {
    return "cashtag" in e;
github Submitty / pdf-annotate.js / examples / mega / index.js View on Github external
function insertComment(comment) {
    let child = document.createElement('div');
    child.className = 'comment-list-item';
    child.innerHTML = twitter.autoLink(twitter.htmlEscape(comment.content));

    commentList.appendChild(child);
  }
github r7kamura / retro-twitter-client / src / renderer / components / tweet-body.js View on Github external
getText() {
    if (this.props.urlEntity && this.props.urlEntity.display_url) {
      return twitterText.linkTextWithEntity(this.props.urlEntity, { invisibleTagAttrs: "style='position:absolute;left:-9999px;'" });
    } else {
      return twitterText.htmlEscape(this.props.displayUrl);
    }
  }
github r7kamura / retro-twitter-client / src / renderer / components / tweet-body.js View on Github external
getText() {
    return '#' + twitterText.htmlEscape(this.props.entity.hashtag);
  }
github r7kamura / retro-twitter-client / src / renderer / components / tweet-body.js View on Github external
getText() {
    return '$' + twitterText.htmlEscape(this.props.entity.cashtag);
  }
github r7kamura / retro-twitter-client / src / renderer / components / tweet-body.js View on Github external
getText() {
    return '@' + twitterText.htmlEscape(this.getIdentifier());
  }