From 6798a6a8e224471b69018ad5cc4a526654ea5772 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Fri, 10 Oct 2014 14:34:43 -0500 Subject: Allow HTML tags in user Markdown input Allow whitelisted tags to appear in rendered HTML output by disabling Redcarpet's `:filter_html` option. --- lib/gitlab/markdown.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') 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 -- cgit v1.2.1