2018-03-27 19:54:05 +05:30
|
|
|
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>" \
|
2018-10-15 14:42:47 +05:30
|
|
|
"<code#{lang_attr}>#{ERB::Util.html_escape(code)}</code>" \
|
2018-03-27 19:54:05 +05:30
|
|
|
"</pre>"
|
|
|
|
|
|
|
|
out(result)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|