优化临时文件管理
This commit is contained in:
@@ -6,6 +6,8 @@ from playwright.async_api import async_playwright
|
||||
import os
|
||||
import asyncio
|
||||
|
||||
from loguru import logger
|
||||
|
||||
|
||||
# linux 下需要安装字体
|
||||
# sudo apt-get install -y fonts-noto-cjk fonts-noto-cjk-extra
|
||||
@@ -240,8 +242,7 @@ async def convert_md_str_to_image(md_content, output_image):
|
||||
temp_html = f"temp_output_{timestamp}.html"
|
||||
md_str_to_html(md_content, temp_html)
|
||||
await html_to_image(temp_html, output_image)
|
||||
os.remove(temp_html)
|
||||
print(f"图片已生成:{output_image}")
|
||||
logger.debug(f"图片已生成:{output_image}")
|
||||
return os.path.abspath(output_image)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user