fix html escaping

This commit is contained in:
Hussam.lawen
2024-08-14 12:13:51 +03:00
parent 01c18d7d98
commit 4fea780b9b

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import html
import copy
import difflib
import json
@ -770,6 +771,7 @@ def replace_code_tags(text):
"""
Replace odd instances of ` with <code> and even instances of ` with </code>
"""
text = html.escape(text)
parts = text.split('`')
for i in range(1, len(parts), 2):
parts[i] = '<code>' + parts[i] + '</code>'