Browse files

improve sample code for simple_format to accurately show sanitized html

  • Loading branch information...
1 parent 817e8fa commit 0598d391d01655219d4c6d78760ea00304010e10 @rsl committed Apr 9, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 actionpack/lib/action_view/helpers/text_helper.rb
View
7 actionpack/lib/action_view/helpers/text_helper.rb
@@ -250,8 +250,11 @@ def word_wrap(text, options = {})
# simple_format("Look ma! A class!", class: 'description')
# # => "<p class='description'>Look ma! A class!</p>"
#
- # simple_format("<span>I'm allowed!</span> It's true.", {}, sanitize: false)
- # # => "<p><span>I'm allowed!</span> It's true.</p>"
+ # simple_format("<blink>Unblinkable.</blink>")
+ # # => "<p>Unblinkable.</p>"
+ #
+ # simple_format("<blink>Blinkable!</blink> It's true.", {}, sanitize: false)
+ # # => "<p><blink>Blinkable!</span> It's true.</p>"
def simple_format(text, html_options = {}, options = {})
wrapper_tag = options.fetch(:wrapper_tag, :p)

0 comments on commit 0598d39

Please sign in to comment.