twitter/twitter-text-js — pull request #62 by keitaf (2012-06-06 21:01:51+00:00)
Title: Add new options to Autolink

This will add the following options to Autolink.

* symbolTag: a tag to apply around symbol (#,@,$) in hashtag/username/list/cashtag links.
* textWithSymbolTag: a tag to apply around text part in hashtag/username/list/cashtag links.
* urlTarget: the value of target attribute in URL links
* linkAttributeBlock: a block/function to modify attributes of a link based on the entity.
* linkTextBlock: a block/function to modify text of a link based on the entity.

Examples:
````
autoLink("#hash", {symbol_tag: "s"}) => "#hash"
autoLink("#hash", {textWithSymbolTag: "b"}) => "#hash"
autoLink("#hash", {linkAttributeBlock: function(entity, attributes){
if (entity.hashtag) { attributes["custom-attr"] = "some_value"; }
}) => "#hash"
autoLink("#hash", {linkTextBlock: function(entity, text){
return entity.hashtag ? "prefix"+text : text;
}) => "prefix#text"
````

This will also change urlClass option, which is currently applied to all links but will only be applied to URL links.

before, preChunk, postChunk, preText, postText, at and hash options will no longer be available as they are not available in twitter-text-rb/java and they can be replaced by those new options.