This commit is contained in:
Steven Lee 2023-09-12 08:44:50 +00:00
parent a3d1c3362f
commit 95391ca32d
3 changed files with 19 additions and 11 deletions

View file

@ -192,6 +192,7 @@ class CodeParser:
logger.error(f"{pattern} not match following text:")
logger.error(text)
# raise Exception
return ""
return code
@classmethod

View file

@ -34,10 +34,15 @@ def mermaid_to_file(mermaid_code, output_file_without_suffix, width, height):
async def mermaid_to_file0(mermaid_code, output_file_without_suffix, width=2048, height=2048, suffixes=['png', 'svg', 'pdf'])-> int:
__dirname = os.path.dirname(os.path.abspath(__file__))
browser = await launch(headless=True,
executablePath=os.getenv('PUPPETEER_EXECUTABLE_PATH',"/opt/homebrew/bin/chromium"),
args=['--disable-extensions',"--no-sandbox"]
)
executablePath = os.getenv('PUPPETEER_EXECUTABLE_PATH',"")
if executablePath:
browser = await launch(headless=True,
executablePath=executablePath,
args=['--disable-extensions',"--no-sandbox"]
)
else:
print("Please set the environment variable:PUPPETEER_EXECUTABLE_PATH.")
return -1
page = await browser.newPage()
device_scale_factor = 1.0