Skip to content

Instantly share code, notes, and snippets.

@tschmidt
Created July 14, 2011 21:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tschmidt/1083456 to your computer and use it in GitHub Desktop.
Save tschmidt/1083456 to your computer and use it in GitHub Desktop.
Rails simple_format and auto_link weirdness
@kabdelhady
Copy link

I have the exact same issue

@rvrm
Copy link

rvrm commented Mar 7, 2013

simple_format( link_to( ... ) ) also strips the target.

@leisti
Copy link

leisti commented Apr 13, 2014

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