5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/helpers/postnhost/article_helper.rb', line 5
def render_article_content(content)
content = content&.gsub("<p></p>", "<p><br></p>")
content = content&.gsub(%r{<p>\s*</p>}, "<p><br></p>")
sanitized_content = sanitize(
content,
tags: %w[p h1 h2 h3 h4 h5 h6 strong em u s sup sub mark code pre span blockquote ul ol li a img table colgroup col thead tbody tr th td br
hr div iframe],
attributes: %w[href src alt class style target rel width height colspan rowspan frameborder allow allowfullscreen title]
)
highlight_code_blocks(sanitized_content)
end
|