instance method
strip_links
Ruby on Rails 7.0.10
Signature
strip_links(html)
Strips all link tags from html leaving just the link text.
strip_links('<a href="http://www.rubyonrails.org">Ruby on Rails</a>')
# => Ruby on Rails
strip_links('Please e-mail me at <a href="mailto:me@email.com">me@email.com</a>.')
# => Please e-mail me at me@email.com.
strip_links('Blog: <a href="http://www.myblog.com/" class="nav" target=\"_blank\">Visit</a>.')
# => Blog: Visit.
strip_links('<<a href="https://example.org">malformed & link</a>')
# => <malformed & link
Parameters
-
htmlreq
Source
# File actionview/lib/action_view/helpers/sanitize_helper.rb, line 131
def strip_links(html)
self.class.link_sanitizer.sanitize(html)
end
Defined in actionview/lib/action_view/helpers/sanitize_helper.rb line 131
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::SanitizeHelper