Module: Kramdown::Converter::SyntaxHighlighter::MiddlemanPresentation

Defined in:
lib/middleman-presentation-core/syntax_highlighter.rb

Overview

Middleman Presentation Converter

Class Method Summary collapse

Class Method Details

.call(converter, text, lang, type, _unused_opts) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/middleman-presentation-core/syntax_highlighter.rb', line 12

def self.call(converter, text, lang, type, _unused_opts)
  opts = converter.options[:syntax_highlighter_opts].dup
  text = ERB::Util.html_escape(text)

  case type
  when :span
    %(<code class=\"#{opts[:inline_code_class]}\">#{text}</code>)
  when :block
    %(<pre class=\"#{opts[:code_block_class]}\"><code class=\"#{opts[:language_prefix]}#{lang}\">#{text}</code></pre>)
  else
    %(<pre class=\"#{opts[:code_block_class]}\"><code class=\"#{opts[:language_prefix]}#{lang}\">#{text}</code></pre>)
  end
end