debian-mirror-gitlab/lib/banzai/renderer/common_mark/html.rb

22 lines
633 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2021-12-11 22:18:48 +05:30
# Remove this entire file when removing `use_cmark_renderer` feature flag and switching to the CMARK html renderer.
# https://gitlab.com/gitlab-org/gitlab/-/issues/345744
2018-03-27 19:54:05 +05:30
module Banzai
module Renderer
module CommonMark
class HTML < CommonMarker::HtmlRenderer
def code_block(node)
block do
2018-11-20 20:47:30 +05:30
out("<pre#{sourcepos(node)}><code")
out(' lang="', node.fence_info, '"') if node.fence_info.present?
out('>')
out(escape_html(node.string_content))
out('</code></pre>')
2018-03-27 19:54:05 +05:30
end
end
end
end
end
end