diff --git a/modules/html_generator.py b/modules/html_generator.py index 3d9f758b..0026ba4e 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -54,6 +54,9 @@ def convert_to_markdown(string): if line.lstrip(' ').startswith('```'): is_code = not is_code + if is_code: + line = html.unescape(line) + result += line if is_code or line.startswith('|'): # Don't add an extra \n for tables or code result += '\n' @@ -75,14 +78,14 @@ def convert_to_markdown(string): result = re.sub(r'(\d+\.)$', r'\g<1> ' + delete_str, result) - html = markdown.markdown(result, extensions=['fenced_code', 'tables']) - pos = html.rfind(delete_str) + html_output = markdown.markdown(result, extensions=['fenced_code', 'tables']) + pos = html_output.rfind(delete_str) if pos > -1: - html = html[:pos] + html[pos + len(delete_str):] + html_output = html_output[:pos] + html_output[pos + len(delete_str):] else: - html = markdown.markdown(result, extensions=['fenced_code', 'tables']) + html_output = markdown.markdown(result, extensions=['fenced_code', 'tables']) - return html + return html_output def generate_basic_html(string):