twitter/twitter-text-js — pull request #75 by twuttke (2012-12-11 07:42:54+00:00)
Title: Add an autolink option to htmlEscape the non-entities in a tweet

I need a way to convert raw tweet text that was just typed in (hasn't been html escaped at all) into safe html markup. My problem with the current code is that it escapes text as it autolinks elements, but not the plain text between elements.

In other words,
"< example.com/?a&b"
gets converted into something like
"< example.com/?a&b""
rather than
"< example.com/?a&b""

If I pre-escape the text myself, then the code that autolinks entities will add a redundant layer of escaping on the url.

I assume the current behavior is desirable in some circumstances, so I added this functionality as an option. For example, tweets coming from twitter already have & < and > escaped.