Autolinker.js icon indicating copy to clipboard operation
Autolinker.js copied to clipboard

Request: Adding a new hashtag provider

Open the-conqueror-97 opened this issue 4 years ago • 1 comments

Hi, i just found this library and i believe it can be improved. So i would like to add one more provider to the project.

So we have already Facebook, Twitter and Instagram. I would like to add "Aktagram".

If it could be added as soon as possible it would be nice.

/** * Returns the anchor href that should be generated for the match. * * @return {String} */ HashtagMatch.prototype.getAnchorHref = function () { var serviceName = this.serviceName, hashtag = this.hashtag; switch (serviceName) { case 'twitter': return 'https://twitter.com/hashtag/' + hashtag; case 'facebook': return 'https://www.facebook.com/hashtag/' + hashtag; case 'instagram': return 'https://instagram.com/explore/tags/' + hashtag; case 'aktagram': return 'https://aktagram.com/hashtag/' + hashtag; default: // Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case. throw new Error('Unknown service name to point hashtag to: ' + serviceName); } };

the-conqueror-97 avatar Mar 12 '21 17:03 the-conqueror-97

PRs are welcome! :)

olafleur avatar Mar 12 '21 19:03 olafleur