fix image display bug
This commit is contained in:
@@ -458,6 +458,11 @@ def contain_html_tag(text):
|
|||||||
return re.search(pattern, text) is not None
|
return re.search(pattern, text) is not None
|
||||||
|
|
||||||
|
|
||||||
|
def contain_image(text):
|
||||||
|
pattern = r'<br/><br/><div align="center"><img src="file=(.*?)" base64="(.*?)"></div>'
|
||||||
|
return re.search(pattern, text) is not None
|
||||||
|
|
||||||
|
|
||||||
def compat_non_markdown_input(text):
|
def compat_non_markdown_input(text):
|
||||||
"""
|
"""
|
||||||
改善非markdown输入的显示效果,例如将空格转换为 ,将换行符转换为</br>等。
|
改善非markdown输入的显示效果,例如将空格转换为 ,将换行符转换为</br>等。
|
||||||
@@ -468,8 +473,11 @@ def compat_non_markdown_input(text):
|
|||||||
return text
|
return text
|
||||||
elif ("<" in text) and (">" in text) and contain_html_tag(text):
|
elif ("<" in text) and (">" in text) and contain_html_tag(text):
|
||||||
# careful input:html输入
|
# careful input:html输入
|
||||||
escaped_text = html.escape(text)
|
if contain_image(text):
|
||||||
return escaped_text
|
return text
|
||||||
|
else:
|
||||||
|
escaped_text = html.escape(text)
|
||||||
|
return escaped_text
|
||||||
else:
|
else:
|
||||||
# whatever input:非markdown输入
|
# whatever input:非markdown输入
|
||||||
lines = text.split("\n")
|
lines = text.split("\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user