diff --git a/toolbox.py b/toolbox.py index 0b1c85c..75cc847 100644 --- a/toolbox.py +++ b/toolbox.py @@ -6,7 +6,7 @@ import traceback import importlib import inspect import re -from show_math import convert as convert_math +from latex2mathml.converter import convert as tex2mathml from functools import wraps, lru_cache @@ -203,8 +203,51 @@ def markdown_convertion(txt): """ pre = '
' suf = '
' - if ('$' in txt) and ('```' not in txt): - return pre + markdown.markdown(txt, extensions=['fenced_code', 'tables']) + '

' + markdown.markdown(convert_math(txt, splitParagraphs=False), extensions=['fenced_code', 'tables']) + suf + markdown_extension_configs = { + 'mdx_math': { + 'enable_dollar_delimiter': True, + 'use_gitlab_delimiters': False, + }, + } + find_equation_pattern = r'