Spaces:
Runtime error
Runtime error
正确显示列表序号
Browse files- toolbox.py +2 -2
toolbox.py
CHANGED
|
@@ -240,7 +240,7 @@ def markdown_convertion(txt):
|
|
| 240 |
if ('$' in txt) and ('```' not in txt): # 有$标识的公式符号,且没有代码段```的标识
|
| 241 |
# convert everything to html format
|
| 242 |
split = markdown.markdown(text='---')
|
| 243 |
-
convert_stage_1 = markdown.markdown(text=txt, extensions=['mdx_math', 'fenced_code', 'tables'], extension_configs=markdown_extension_configs)
|
| 244 |
# 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).
|
| 245 |
# 1. convert to easy-to-copy tex (do not render math)
|
| 246 |
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):
|
|
| 249 |
# cat them together
|
| 250 |
return pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf
|
| 251 |
else:
|
| 252 |
-
return pre + markdown.markdown(txt, extensions=['fenced_code', 'tables']) + suf
|
| 253 |
|
| 254 |
|
| 255 |
def close_up_code_segment_during_stream(gpt_reply):
|
|
|
|
| 240 |
if ('$' in txt) and ('```' not in txt): # 有$标识的公式符号,且没有代码段```的标识
|
| 241 |
# convert everything to html format
|
| 242 |
split = markdown.markdown(text='---')
|
| 243 |
+
convert_stage_1 = markdown.markdown(text=txt, extensions=['mdx_math', 'fenced_code', 'tables', 'sane_lists'], extension_configs=markdown_extension_configs)
|
| 244 |
# 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).
|
| 245 |
# 1. convert to easy-to-copy tex (do not render math)
|
| 246 |
convert_stage_2_1, n = re.subn(find_equation_pattern, replace_math_no_render, convert_stage_1, flags=re.DOTALL)
|
|
|
|
| 249 |
# cat them together
|
| 250 |
return pre + convert_stage_2_1 + f'{split}' + convert_stage_2_2 + suf
|
| 251 |
else:
|
| 252 |
+
return pre + markdown.markdown(txt, extensions=['fenced_code', 'tables', 'sane_lists']) + suf
|
| 253 |
|
| 254 |
|
| 255 |
def close_up_code_segment_during_stream(gpt_reply):
|