diff --git a/toolbox.py b/toolbox.py
index 2d98f88..f6cb609 100644
--- a/toolbox.py
+++ b/toolbox.py
@@ -1,21 +1,16 @@
import markdown
import importlib
-import time
import inspect
-import re
import gradio as gr
import func_box
-import os
from latex2mathml.converter import convert as tex2mathml
from functools import wraps, lru_cache
-import logging
import shutil
import os
import time
import glob
import sys
from concurrent.futures import ThreadPoolExecutor
-import html
############################### 插件输入输出接驳区 #######################################
"""
@@ -297,7 +292,7 @@ def text_divide_paragraph(input_str):
return input_str
-@lru_cache(maxsize=128) # 使用 lru缓存 加快转换速度
+@lru_cache(maxsize=128) # 使用 lru缓存 加快转换速度
def markdown_convertion(txt):
"""
将Markdown格式的文本转换为HTML格式。如果包含数学公式,则先将公式转换为HTML格式。
@@ -306,14 +301,15 @@ def markdown_convertion(txt):
suf = ''
if txt.startswith(pre) and txt.endswith(suf):
# print('警告,输入了已经经过转化的字符串,二次转化可能出问题')
- return txt # 已经被转化过,不需要再次转化
-
+ return txt # 已经被转化过,不需要再次转化
+
markdown_extension_configs = {
'mdx_math': {
'enable_dollar_delimiter': True,
'use_gitlab_delimiters': False,
},
}
+ find_equation_pattern = r'\n', '')
return content
def no_code(txt):
- if '```' not in txt:
+ if '```' not in txt:
return True
else:
- if '```reference' in txt: return True # newbing
- else: return False
+ if '```reference' in txt:
+ return True # newbing
+ else:
+ return False
- if ('$$' in txt) and no_code(txt): # 有$标识的公式符号,且没有代码段```的标识
+ if ('$' in txt) and no_code(txt): # 有$标识的公式符号,且没有代码段```的标识
# convert everything to html format
split = markdown.markdown(text='---')
- find_equation_pattern = r'