def _get_markdown_renderer():
 class PygmentsHighlighter(mistune.Renderer, ):
  def block_code(self, code, lang=None):
   if (not lang):
    return ('\n<pre><code>%s</code></pre>\n' % mistune.escape(code))
   lexer = get_lexer_by_name(lang, stripall=True)
   formatter = HtmlFormatter(classprefix='highlight ')
   return highlight(code, lexer, formatter)
 return mistune.Markdown(renderer=PygmentsHighlighter())

def _get_markdown_renderer ( ) : class PygmentsHighlighter ( mistune . Renderer , ) : def block_code ( self , code , lang = None ) : if ( not lang ) : return ( '\n<pre><code>%s</code></pre>\n' % mistune . escape ( code ) ) lexer = get_lexer_by_name ( lang , stripall = True ) formatter = HtmlFormatter ( classprefix = 'highlight ' ) return highlight ( code , lexer , formatter ) return mistune . Markdown ( renderer = PygmentsHighlighter ( ) )
returns a function to convert a markdown string into pygments-highlighted html .