From 2e3f6b3126b17dbc2ee85d458187e92730518331 Mon Sep 17 00:00:00 2001 From: qingxu fu <505030475@qq.com> Date: Fri, 7 Apr 2023 18:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E6=98=BE=E7=A4=BA=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- toolbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolbox.py b/toolbox.py index 0ddcf96..f42c3a2 100644 --- a/toolbox.py +++ b/toolbox.py @@ -240,7 +240,7 @@ def markdown_convertion(txt): if ('$' in txt) and ('```' not in txt): # 有$标识的公式符号,且没有代码段```的标识 # convert everything to html format split = markdown.markdown(text='---') - convert_stage_1 = markdown.markdown(text=txt, extensions=['mdx_math', 'fenced_code', 'tables'], extension_configs=markdown_extension_configs) + convert_stage_1 = markdown.markdown(text=txt, extensions=['mdx_math', 'fenced_code', 'tables', 'sane_lists'], extension_configs=markdown_extension_configs) # re.DOTALL: Make the '.' special character match any character at all, including a newline; without this flag, '.' will match anything except a newline. Corresponds to the inline flag (?s). # 1. convert to easy-to-copy tex (do not render math) convert_stage_2_1, n = re.subn(find_equation_pattern, replace_math_no_render, convert_stage_1, flags=re.DOTALL) @@ -249,7 +249,7 @@ def markdown_convertion(txt): # cat them together return pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf else: - return pre + markdown.markdown(txt, extensions=['fenced_code', 'tables']) + suf + return pre + markdown.markdown(txt, extensions=['fenced_code', 'tables', 'sane_lists']) + suf def close_up_code_segment_during_stream(gpt_reply):