gitlab-org--gitlab-foss/lib/banzai/renderer/common_mark/html.rb
2018-04-17 11:39:11 +02:00

21 lines
523 B
Ruby

module Banzai
module Renderer
module CommonMark
class HTML < CommonMarker::HtmlRenderer
def code_block(node)
block do
code = node.string_content
lang = node.fence_info
lang_attr = lang.present? ? %Q{ lang="#{lang}"} : ''
result =
"<pre>" \
"<code#{lang_attr}>#{ERB::Util.html_escape(code)}</code>" \
"</pre>"
out(result)
end
end
end
end
end
end