Created
August 24, 2020 03:37
-
-
Save sayrer/97c4d5a0ea15eada487c4fc0b2916261 to your computer and use it in GitHub Desktop.
Twitter Text in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rust_bindings/ruby/twittertext" | |
autolinker = Twittertext::Autolinker.new | |
puts autolinker.autolink "Just setting up my $TWTR or #TWTR or @twitter? Please visit https://twiter.com." | |
# prints | |
# Just setting up my <a href="https://twitter.com/search?q=%24TWTR" title="$TWTR" class="tweet-url cashtag">$TWTR</a> or | |
# <a href="https://twitter.com/search?q=%23TWTR" title="#TWTR" class="tweet-url hashtag">#TWTR</a> or | |
# @<a class="tweet-url username" href="https://twitter.com/twitter">twitter</a>? | |
# Please visit <a href="https://twiter.com">https://twiter.com</a>. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment