html.rb 372 Bytes
Newer Older
1 2
# frozen_string_literal: true

3 4 5 6 7 8 9 10
module Banzai
  module Renderer
    module Redcarpet
      class HTML < ::Redcarpet::Render::HTML
        def block_code(code, lang)
          lang_attr = lang ? %Q{ lang="#{lang}"} : ''

          "\n<pre>" \
11
            "<code#{lang_attr}>#{ERB::Util.html_escape(code)}</code>" \
12 13 14 15 16 17
          "</pre>"
        end
      end
    end
  end
end