Handles the < an > substitution with < and > in a more generic way.
I tested this in my production instance and found no problems.
---
app/utils/highlight.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/utils/highlight.py b/app/utils/highlight.py
index 2e60a36..4f22a92 100644
--- a/app/utils/highlight.py
+++ b/app/utils/highlight.py
@@ -39,8 +39,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_content = code_content.replace(">", ">")
+ code_content = code_content.replace("<", "<")
code.parent.replaceWith(
BeautifulSoup(
phighlight(code_content, lexer, _FORMATTER), "html5lib"
--
2.40.0.windows.1