Keep HTML line breaks

They do appear in long_description on au_prod.
This commit is contained in:
Maikel Linke
2024-05-14 12:40:39 +10:00
parent 23a27c65be
commit f089c0eff3
2 changed files with 3 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ class HtmlSanitizer
def self.sanitize(html)
@sanitizer ||= Rails::HTML5::SafeListSanitizer.new
@sanitizer.sanitize(
html, tags: %w[h1 h2 h3 h4 p b i u a], attributes: %w[href target],
html, tags: %w[h1 h2 h3 h4 p br b i u a], attributes: %w[href target],
)
end
end

View File

@@ -12,9 +12,9 @@ RSpec.describe HtmlSanitizer do
end
it "keeps supported tags" do
html = "Hello <b>alert</b>!"
html = "Hello <b>alert</b>! <br>How are you?"
expect(subject.sanitize(html))
.to eq "Hello <b>alert</b>!"
.to eq "Hello <b>alert</b>! <br>How are you?"
end
it "keeps supported attributes" do