Skip to content

Commit 2701222

Browse files
committed
Add support to link hashtags to either Twitter or Facebook.
1 parent 63afab7 commit 2701222

File tree

10 files changed

+521
-213
lines changed

10 files changed

+521
-213
lines changed

Gruntfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ module.exports = function(grunt) {
6565
'src/matchParser/MatchValidator.js',
6666
'src/match/Match.js',
6767
'src/match/Email.js',
68+
'src/match/Hashtag.js',
6869
'src/match/Phone.js',
6970
'src/match/Twitter.js',
7071
'src/match/Url.js'

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ providing an Object as the second parameter to [Autolinker.link()](http://gregja
133133
- [twitter](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-twitter) : Boolean<br />
134134
`true` to have Twitter handles auto-linked, `false` to skip auto-linking of
135135
Twitter handles. Defaults to `true`.<br /><br />
136-
- [hashtag](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-hashtag) : Boolean<br />
137-
`true` to have hashtags auto-linked, `false` to skip auto-linking of
138-
hashtags. Defaults to `false`.<br /><br />
136+
- [hashtag](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-hashtag) : Boolean/String<br />
137+
A string for the service name to have hashtags auto-linked to. Supported
138+
values at this time are 'twitter' and 'facebook'. Pass `false` to skip
139+
auto-linking of hashtags. Defaults to `false`.<br /><br />
139140
- [replaceFn](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-replaceFn) : Function<br />
140141
A function to use to programmatically make replacements of matches in the
141142
input string, one at a time. See the section
@@ -228,9 +229,9 @@ var linkedText = Autolinker.link( input, {
228229

229230
case 'phone' :
230231
var phoneNumber = match.getPhoneNumber();
231-
console.log( twitterHandle );
232+
console.log( phoneNumber );
232233

233-
return '<a href="http://newplace.to.link.twitter.handles.to/">' + twitterHandle + '</a>';
234+
return '<a href="http://newplace.to.link.phone.numbers.to/">' + phoneNumber + '</a>';
234235

235236
case 'twitter' :
236237
var twitterHandle = match.getTwitterHandle();

0 commit comments

Comments
 (0)