npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

break-tweet-autolink

v0.3.1

Published

Break auto links in tweet text

Downloads

22

Readme

Break Auto Links in Tweet

This repository provides a library and tools to remove auto links in tweet text.

Tweet form in https://twitter.com or https://mobile.twitter.com automatically links many things such as screen names, hashtags, URLs. The library and tools provide the capability to remove these links programmatically by inserting zero-width space (\u200B).

Why?

Did you experience various stuffs are linked unintentionally? For example,

  • method call such as receiver.foo()
  • markdown file name such as README.md
  • C's preprocessor macros such as #include
  • Ruby's instance variable @foo and/or global variables $bar

If you experienced and felt it annoying, tools or library provided by this repository would help you.

Usage

Web

As the easiest way to access the feature provided by this repository, small web app is hosted on GitHub pages.

Screenshot for website

  1. Cut your tweet to clipboard at twitter.com or mobile.twitter.com
  2. Visit https://rhysd.github.io/unlink-tweet
  3. Click button
  4. Back to Twitter and paste clipboard text

This site utilizes navigator.clipboard for accessing clipboard. When you click the button at first time, your browser will ask your permission.

If your browser does not support navigator.clipboard, it falls back to <textarea>. Please paste your tweet text to the text area and click the button, then cut the text in text area.

This site is implemented here.

Chrome Extension

If you use the feature frequently, this repository offers a Chrome Extension.

Screenshot for Chrome extension

You can easily remove auto links in selected text at twitter.com or mobile.twitter.com. The easiest way is using a context menu item.

  1. Select your tweet text in a tweet form at twitter.com or mobile.twitter.com.
  2. Right click
  3. Choose 'Unlink Tweet Text' item

It automatically update selected text with unlinked text.

The extension is implemented here. Please read its README.md for more details.

CLI

If you're terminal junky and post tweets from command line, this repository even offers a command line tool to remove auto links in tweet text. Node.js is necessary.

To use the tool, install it via npm

$ npm install -g unlink-tweet-cli
$ unlink-tweet --help

Or running the command without installing the npm package thanks to npx is also supported.

$ npx unlink-tweet-cli --help

Interface of the CLI is

unlink-tweet {text}

or

unlink-tweet [options] -- {text}

{text} can be multiple arguments. In the case, all arguments are joined with one white space. And it outputs unlinked text to STDOUT.

The CLI tool is implemented here. Please read its README.md for more details.

Library

npm package is available. It can be used programmatically from JavaScript.

npm install --save break-tweet-autolink

Please import TweetAutoLinkBreaker class and construct instance with configuration.

const { TweetAutoLinkBreaker } = require('break-tweet-autolink');

const b = new TweetAutoLinkBreaker({
    hashtag: true,       // Break hashtag links such as #hashtag
    urlNoScheme: true,   // Break URLs with no scheme such as example.com
    urlWithScheme: true, // Break URLs with scheme such as https://example.com
    cashtag: true,       // Break cashtag links such as $TWTR
    mention: true,       // Break mentions such as @foo
    list: true,          // Break list mentions such as @foo/bar
});

const text = 'This #text has $MANY @autolinks please remove it.com';
const unlinked = b.breakAutoLinks(text);

console.log('Unlinked:', text);

The package also contains TypeScript type definitions. Please see index.d.ts in the installed package to know APIs.

License

Library and all tools are distributed under the MIT License.