diff --git a/docs/generate_html_pages.py b/docs/generate_html_pages.py index 4be7f6d8f..577e3a432 100644 --- a/docs/generate_html_pages.py +++ b/docs/generate_html_pages.py @@ -19,7 +19,8 @@ import sys import talib -import mistune.renderers +import mistune + from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatters.html import HtmlFormatter @@ -211,11 +212,11 @@ def get_markdown_file_paths(): def _get_markdown_renderer(): """Returns a function to convert a Markdown string into pygments-highlighted HTML""" - class PygmentsHighlighter(mistune.renderers.HTMLRenderer): - def block_code(self, code, lang=None): - if not lang: + class PygmentsHighlighter(mistune.HTMLRenderer): + def block_code(self, code, info=None): + if not info: return '\n
%s
\n' % mistune.escape(code)
- lexer = get_lexer_by_name(lang, stripall=True)
+ lexer = get_lexer_by_name(info, stripall=True)
formatter = HtmlFormatter(classprefix='highlight ')
return highlight(code, lexer, formatter)
return mistune.Markdown(renderer=PygmentsHighlighter())