lib/kramdown/converter/latex.rb in kramdown-1.6.0 vs lib/kramdown/converter/latex.rb in kramdown-1.7.0

- old
+ new

@@ -82,11 +82,16 @@ end def convert_codeblock(el, opts) show_whitespace = el.attr['class'].to_s =~ /\bshow-whitespaces\b/ lang = extract_code_language(el.attr) - if show_whitespace || lang + + if @options[:syntax_highlighter] == :minted && + (highlighted_code = highlight_code(el.value, lang, :block)) + @data[:packages] << 'minted' + "#{latex_link_target(el)}#{highlighted_code}\n" + elsif show_whitespace || lang options = [] options << "showspaces=%s,showtabs=%s" % (show_whitespace ? ['true', 'true'] : ['false', 'false']) options << "language=#{lang}" if lang options << "basicstyle=\\ttfamily\\footnotesize,columns=fixed,frame=tlbr" id = el.attr['id'] @@ -224,10 +229,17 @@ '' end end def convert_codespan(el, opts) - "{\\tt #{latex_link_target(el)}#{escape(el.value)}}" + lang = extract_code_language(el.attr) + if @options[:syntax_highlighter] == :minted && + (highlighted_code = highlight_code(el.value, lang, :span)) + @data[:packages] << 'minted' + "#{latex_link_target(el)}#{highlighted_code}" + else + "{\\tt #{latex_link_target(el)}#{escape(el.value)}}" + end end def convert_footnote(el, opts) @data[:packages] << 'fancyvrb' "\\footnote{#{inner(el.value, opts).rstrip}}"