Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

taghash

radiovisual22MIT1.2.2

Convert plain-text hashtags into twitter-ready hyperlinks

twitter, hashtag, hashtags, hyperlinks, anchor, a, convert, string, plain-text, hash, tag, href, pound

readme

taghash

Convert plain-text hashtags into twitter-ready hyperlinks.

Build Status

Usage

var taghash = require('taghash');

taghash('Some text with #acoolhash');
//=> 'Some text with <a href="https://twitter.com/hashtag/acoolhash">#acoolhash</a>'

taghash('#many #hastags');
//=> '<a href="https://twitter.com/hashtag/many">#many</a> <a href="https://twitter.com/hashtag/hastags">#hastags</a>'

API

taghash(string, [options])

Returns a string with hashtags converted to hyperlinks.

string

Required
Type: string

The string with hashtags you want to convert.

options

href

Type: string
Default: 'https://twitter.com/hashtag/'

The href value you want to use when surrounding your hashtags with a url. The default is Twitter's hashtag url.

taghash('pass custom src #hashtag!', {href: 'http://example.com/'});
//=> 'pass custom src <a href="http://example.com/hashtag">#hashtag</a>!'

License

MIT @ Michael Wuergler