2018-08-03 03:15:25 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-13 13:21:07 -04:00
|
|
|
module BlobViewer
|
|
|
|
class Markup < Base
|
|
|
|
include Rich
|
|
|
|
include ServerSide
|
|
|
|
|
|
|
|
self.partial_name = 'markup'
|
|
|
|
self.extensions = Gitlab::MarkupHelper::EXTENSIONS
|
2017-05-18 15:51:19 -04:00
|
|
|
self.file_types = %i(readme)
|
2017-04-24 13:51:56 -04:00
|
|
|
self.binary = false
|
2020-10-07 08:09:12 -04:00
|
|
|
|
|
|
|
def banzai_render_context
|
|
|
|
{}.tap do |h|
|
|
|
|
h[:rendered] = blob.rendered_markup if blob.respond_to?(:rendered_markup)
|
|
|
|
|
2020-10-16 14:09:04 -04:00
|
|
|
if Feature.enabled?(:cached_markdown_blob, blob.project, default_enabled: true)
|
2020-10-07 08:09:12 -04:00
|
|
|
h[:cache_key] = ['blob', blob.id, 'commit', blob.commit_id]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-04-13 13:21:07 -04:00
|
|
|
end
|
|
|
|
end
|