更新时间:2023-02-17 23:40:29
autolink会做到这一点。它被提取到它自己的宝石中......
autolink will do it. It's been extracted into it's own gem...
https: //github.com/tenderlove/rails_autolink
示例用法:
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"