修复markdown公式显示错误的问题

This commit is contained in:
xunbu
2025-08-23 21:31:07 +08:00
parent 1a27efb3cd
commit 78da02ec9c
4 changed files with 16 additions and 25 deletions

View File

@@ -211,16 +211,6 @@ def unembed_base64_images_to_zip(markdown:str,markdown_name:str,image_folder_nam
zipf.write(file, file.relative_to(folder_path))
return zip_buffer.getvalue()
def clean_markdown_math_block(markdown):
"""清除公式块的多余空格字符"""
def replace_block(match: re.Match):
return f"{match.group(1).strip()}\n{match.group(2).strip()}\n{match.group(3).lstrip()}"
pattern = re.compile(r"(^\s*\$\$\s*)\n([\s\S]+?)\n(^\s*\$\$\s*$)", re.MULTILINE)
cleaned_text = pattern.sub(replace_block, markdown)
return cleaned_text
if __name__ == '__main__':
pass