1

Tried searching with Google but found nothing similar...

I have an app that uses textile to format messages. I am trying to tighten up the security and only allow HTML generated via textile markup. So I enabled :filter_html option as per RedCloth docs.

text = RedCloth.new(input_text, [:filter_html]).to_html

Now, I'm trying to extend RedCloth with a custom filter. It replaces some custom codes with some HTML (namely tags). It's very similar what is done in smileys filter example: https://github.com/jgarber/redcloth/blob/master/spec/extension_spec.rb

text = RedCloth.new(input_text, [:filter_html]).to_html(:custom_filter)

The problem is by enabling :filter_html, redcloth html-encodes the HTML output produced by my custom filter.

I have tried marking the output of my custom filter with html_safe, but that does not work.

Any suggestions how to avoid this html-escaping from happening on my customer filter?

Swartz
  • 1,051
  • 2
  • 11
  • 23

0 Answers0