// the find
tenderlove/rails_autolink
The auto_link function from Rails
A gem that extracts the `auto_link` helper removed from Rails 3.1, converting URLs and email addresses in plain text into HTML anchor tags. It's a migration shim for apps that depended on the old Rails method. Scope is intentionally tiny.
Handles the three distinct cases (URLs, emails, both) cleanly with a single `:link` option. Sanitizes HTML by default, so XSS from user-supplied text is handled out of the box. Block form for link text truncation is a nice ergonomic touch. Maintained by tenderlove, so it's not going to be abandoned overnight.
Last commit was October 2023 and the repo is essentially frozen — it does one thing and hasn't needed to change, which is fine, but you should verify it handles modern URL patterns (IPv6, new TLDs, unicode domains) before trusting it on real user input. The `:sanitize => false` option is a foot-gun with no guardrails. Requires a full Rails dependency for what amounts to a regex helper — overkill if you're not already in a Rails app. No mention of how it handles malformed or nested HTML input, which can produce surprising output.