gitlab-org--gitlab-foss/lib/gitlab/other_markup.rb
Luke Duncalfe 49a78d419d Pass all wiki markup formats through pipelines
Previously, when the wiki page format was anything other than `markdown`
or `asciidoc` the formatted content would be returned though a Gitaly
call. Gitaly in turn would delegate formatting to the gitlab-gollum-lib
gem, which in turn would delegate that to various gems (like RDoc for
`rdoc`) and then apply some very liberal sanitization.

It was too liberal!

This change brings our wiki content formatting in line with how we
format other markdown at GitLab, so we have a SSOT for sanitization.

https://gitlab.com/gitlab-org/gitlab/issues/30540
2019-10-23 11:42:37 +13:00

20 lines
517 B
Ruby

# frozen_string_literal: true
module Gitlab
# Parser/renderer for markups without other special support code.
module OtherMarkup
# Public: Converts the provided markup into HTML.
#
# input - the source text in a markup format
#
def self.render(file_name, input, context)
html = GitHub::Markup.render(file_name, input)
.force_encoding(input.encoding)
context[:pipeline] ||= :markup
html = Banzai.render(html, context)
html.html_safe
end
end
end