From 7d760ecf58077fb75f223e1f796573bc5c398981 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Wed, 27 Jul 2022 20:55:03 +0200 Subject: [PATCH] Fix highlight for Python3 --- app/utils/highlight.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/utils/highlight.py b/app/utils/highlight.py index 4915527..b9a2f34 100644 --- a/app/utils/highlight.py +++ b/app/utils/highlight.py @@ -38,6 +38,8 @@ def highlight(html: str) -> str: lexer = guess_lexer(code_content) # Replace the code with Pygment output + # XXX: the HTML escaping causes issue with Python type annotations + code_content = code_content.replace(") -> ", ") -> ") code.parent.replaceWith( BeautifulSoup( phighlight(code_content, lexer, _FORMATTER), "html5lib"