summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVinnie Okada <vokada@mrvinn.com>2014-10-10 14:34:43 -0500
committerVinnie Okada <vokada@mrvinn.com>2014-10-10 14:42:24 -0500
commit6798a6a8e224471b69018ad5cc4a526654ea5772 (patch)
treee865939c0257e25c24f27e772d5a19b9fc088f09 /lib
parentf7342ce56764aaf6465bca74239955778c25107b (diff)
downloadgitlab-ce-6798a6a8e224471b69018ad5cc4a526654ea5772.tar.gz
Allow HTML tags in user Markdown input
Allow whitelisted tags to appear in rendered HTML output by disabling Redcarpet's `:filter_html` option.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/markdown.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 17512a51658..464b88d07ea 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -80,6 +80,11 @@ module Gitlab
markdown_context)
text = result[:output].to_html(save_with: 0)
+ sanitize_html(text)
+ end
+
+ # Remove HTML tags and attributes that are not whitelisted
+ def sanitize_html(text)
allowed_attributes = ActionView::Base.sanitized_allowed_attributes
allowed_tags = ActionView::Base.sanitized_allowed_tags