Python utility to convert markdown and html to image using markdown and playwright.
pip install markdown2image
playwright install chromiumJust
from markdown2image import sync_api as md2img
md2img.html2image(html_code, save_path)
md2img.html2image(html_code, save_path, width=1080)
md2img.markdown2image(markdown_code, save_path)
md2img.markdown2image(markdown_code, save_path, width=1080)Or in a running event loop,
from markdown2image import async_api as md2img
async def func():
await md2img.html2image(html_code, save_path)
await md2img.html2image(html_code, save_path, width=1080)
await md2img.markdown2image(markdown_code, save_path)
await md2img.markdown2image(markdown_code, save_path, width=1080)See main.py for example code