Skip to content

Commit

Permalink
Improve LinkSanitizer's documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanito Fatas committed May 10, 2019
1 parent 2523282 commit 5d735a7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/rails/html/sanitizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ def sanitize(html, options = {})
end

# === Rails::Html::LinkSanitizer
# Removes a tags and href attributes leaving only the link text
# Removes +a+ tags and +href+ attributes leaving only the link text.
#
# link_sanitizer = Rails::Html::LinkSanitizer.new
# link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
# # => Only the link text will be kept.
# link_sanitizer = Rails::Html::LinkSanitizer.new
# link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
#
# => 'Only the link text will be kept.'
class LinkSanitizer < Sanitizer
def initialize
@link_scrubber = TargetScrubber.new
Expand Down

0 comments on commit 5d735a7

Please sign in to comment.