diff options
author | Vinnie Okada <vokada@mrvinn.com> | 2014-10-10 14:34:43 -0500 |
---|---|---|
committer | Vinnie Okada <vokada@mrvinn.com> | 2014-10-10 14:42:24 -0500 |
commit | 6798a6a8e224471b69018ad5cc4a526654ea5772 (patch) | |
tree | e865939c0257e25c24f27e772d5a19b9fc088f09 /lib | |
parent | f7342ce56764aaf6465bca74239955778c25107b (diff) | |
download | gitlab-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.rb | 5 |
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 |