Sanitizing CSS in Rails

Rails HTML Sanitizing

I don't think you want to sanitize it. Sanitizing strips HTML, leaving the text behind, except for the HTML elements you deem OK. It is intended for allowing a user-input field to contain some markup.

Instead, you probably want to parse it. For example, the following will print the text content of the <p> tags in a given html string.

doc = Nokogiri::HTML.parse(html)

doc.search('p').each do |el|
puts el.text
end

How to enable using css url function with loofah?

I'm afraid it doesn't work because the url filter is hardcoded.

Rails sanitize tag and background-image

I just use raw without sanitize



Related Topics



Leave a reply



Submit