Skip to content

mindtonic/autolinks

Repository files navigation

autolinks

Autolinks automatically replaces urls, emails, twitter handles and hashtags with html links

# Text block to render
text = "@thishandle #communicates with @thisotherhandle. This is a test string with some #hashtags and 
other types of #marked #content. winning! We're #1! email@email.com. We're also going to test some URL's: 
http://google.com, or http://google.com/, or http://google.co.uk."

# Render out the HTML
puts Autolinks.parse(text)

=> <a href="http://twitter.com/thishandle" target="_blank">@thishandle</a> 
<a href="http://twitter.com/search?q=%23communicates" target="_blank">#communicates</a> with 
<a href="http://twitter.com/thisotherhandle" target="_blank">@thisotherhandle</a>. This is a test string 
with some <a href="http://twitter.com/search?q=%23hashtags" target="_blank">#hashtags</a> and other types 
of <a href="http://twitter.com/search?q=%23marked" target="_blank">#marked</a> 
<a href="http://twitter.com/search?q=%23content" target="_blank">#content</a>. winning! We're 
<a href="http://twitter.com/search?q=%231" target="_blank">#1</a>! 
<a href="mailto:email@email.com" target="_blank">email@email.com</a>. We're also going to test some URL's: 
<a href="http://google.com" target="_blank">google.com</a>, or 
<a href="http://google.com" target="_blank">google.com</a>/, or 
<a href="http://google.co.uk" target="_blank">google.co.uk</a>.
  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 mindtonic. See LICENSE.txt for further details.

About

Autolinks automatically replaces urls, emails, twitter handles and hashtags with html links

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages