Created
July 14, 2011 21:12
-
-
Save tschmidt/1083456 to your computer and use it in GitHub Desktop.
Rails simple_format and auto_link weirdness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This does not appear to recognize the :target => "_blank" when the page is rendered | |
simple_format(auto_link(@task.description, :html => { :target => "_blank" })) | |
# However, this works fine | |
auto_link(simple_format(@task.description), :html => { :target => "_blank" }) |
simple_format( link_to( ... ) ) also strips the target.
Same problem, but I found that doing this causes simple_format to preserve the target:
simple_format(some_anchor, {}, sanitize: false)
when some_anchor is a link that contains the 'target: "_blank"' attribute.
However, specifying
simple_format(link_to("foo", "http://example.com/"), html: { target: "_blank" }, sanitize: false)
still loses the 'target: "_blank"' attribute.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have the exact same issue