def _format_source(self, source):
formatter = HtmlFormatter(nowrap=True)
html = highlight(source, PythonLexer(), formatter)
return {
'html_lines': [Markup(l) for l in html.splitlines()],
'css': formatter.get_style_defs()
}
评论列表
文章目录