<s> import mistune <EOL> from pygments import highlight <EOL> from pygments . lexers import get_lexer_by_name <EOL> from pygments . formatters import HtmlFormatter <EOL> class MyRenderer ( mistune . Renderer ) : <EOL> def block_code ( self , code , lang ) : <EOL> if not lang : <EOL> return '<STR_LIT>' % mistune . escape ( code ) <EOL> lexer = get_lexer_by_name ( lang , stripall = True ) <EOL> formatter = HtmlFormatter ( ) <EOL> return highlight ( code , lexer , formatter ) <EOL> renderer = MyRenderer ( ) <EOL> md_renderer = mistune . Markdown ( renderer = renderer , escape = True ) </s>
