= simple_format(styled_text_for_tagged_text(block.text_block.body, article))
This appears to be stripping attributes like target="_blank"
out of my link. I can't use auto_link
. Any suggestions on how to fix this?
A much better way to do this is to turn off the sanitizer in the simple_format method, and call sanitize on the contents yourself, where you can specify not to strip the target attributes out.
= simple_format(sanitize(body, attributes: ["href", "target"]), {}, sanitize: false)
Then you get the benefits of both simple_format and sanitize.
Ref Rails removes target="_blank"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With